This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

spinkalher
spinkalher

MarSch said:

I am not sure if that solves all problems here described, but when i tested the solution of this guide i got for some of my forms error when they contained formwidgets e.g. a relation, fileupload ...

After some searching in errorlogs i understood, that by using formwidgets in the frontend, formwidgets are not registered... so the field-type-description in YAML-file (e.g. codeeditor) is unknown. By registering all common formwidgets of the backend in our new plugin, it should work.

/plugin.php of our forms-component / public function registerFormWidgets() { return [ 'Backend\FormWidgets\CodeEditor' => [ 'label' => 'Code editor', 'code' => 'codeeditor' ],

       'Backend\FormWidgets\RichEditor' => [
           'label' => 'Rich editor',
           'code'  => 'richeditor'
       ],

       'Backend\FormWidgets\MarkdownEditor' => [
           'label' => 'Markdown editor',
           'code'  => 'markdown'
       ],

       'Backend\FormWidgets\FileUpload' => [
           'label' => 'File uploader',
           'code'  => 'fileupload'
       ],

       'Backend\FormWidgets\Relation' => [
           'label' => 'Relationship',
           'code'  => 'relation'
       ],

       'Backend\FormWidgets\DatePicker' => [
           'label' => 'Date picker',
           'code'  => 'datepicker'
       ],

       'Backend\FormWidgets\TimePicker' => [
           'label' => 'Time picker',
           'code'  => 'timepicker'
       ],

       'Backend\FormWidgets\ColorPicker' => [
           'label' => 'Color picker',
           'code'  => 'colorpicker'
       ],

       'Backend\FormWidgets\DataTable' => [
           'label' => 'Data Table',
           'code'  => 'datatable'
       ],

       'Backend\FormWidgets\RecordFinder' => [
           'label' => 'Record Finder',
           'code'  => 'recordfinder'
       ],

       'Backend\FormWidgets\Repeater' => [
           'label' => 'Repeater',
           'code'  => 'repeater'
       ],

       'Backend\FormWidgets\TagList' => [
           'label' => 'Tag List',
           'code'  => 'taglist'
       ]
   ];

}

Hope that will help some of you.

Last 5-6 months i am searching for this solution and it's can be working ...

very Thankful for this solution

LMBdev
LMBdev

How can we use this to display a backend list on the frontend, with sort/search/filter functionality? I have the list displayed but none of the functionality is working...

I get errors like "list::onSort()" not available.

BG78
BG78

Hi. Thank you for your nice solution. Is it possible to use it with translation strings (e.g. label: my.plugin::lang.name)? In my case they are not translated in frontend.

cliff30652
cliff30652

Would someone care to give a newbie 5 mins for an explanation of how mja's code works. I've installed his plugin, the mja_forms_entries table is created, but I haven't a clue where I go from there. if I have a form at http://localhost/orders/backend//app/orders/customers how do I re-use this as http://localhost/orders/customers. Help appreciated

chris10207
chris10207

Using the formwidget filepuload with this method, i can attach an image but I cant remove it. Receiving an exception

AJAX Handler BrandLogoFile::onRemoveAttachment not found

anyone faced and solved this issue please?

Last updated

TJMB
TJMB

chris10207 said:

Using the formwidget filepuload with this method, i can attach an image but I cant remove it. Receiving an exception

AJAX Handler BrandLogoFile::onRemoveAttachment not found

anyone faced and solved this issue please?

I'm facing something similar now when using the methods described here to add a frontend form that uses a repeater. I'm getting "AJAX handler 'formAddress::onAddItem' was not found".

@chris10207 did you ever find a solution?

chris10207
chris10207

@TJMB

I used another form widget for the formupload widget

Linkonoid
Linkonoid

You can use my plugin BackToFront, supports all widgets in frontend.

chris10207
chris10207

@Linkonoid nice work! I am just integrating the richeditor in frontend and I am having a fatal exception issue cause of the richeditor code.

Call to a member function hasAccess() on null in /Users/chris/Sites/oc-acme/modules/backend/FormWidgets/RichEditor.php:90

there is no backend user logged in on the frontend , so the exception is thrown

        $this->vars['useMediaManager'] = BackendAuth::getUser()->hasAccess('media.manage_media');

any idea to solve this?

Linkonoid
Linkonoid

chris10207 said:

@Linkonoid nice work! I am just integrating the richeditor in frontend and I am having a fatal exception issue cause of the richeditor code.

Call to a member function hasAccess() on null in /Users/chris/Sites/oc-acme/modules/backend/FormWidgets/RichEditor.php:90

there is no backend user logged in on the frontend , so the exception is thrown

       $this->vars['useMediaManager'] = BackendAuth::getUser()->hasAccess('media.manage_media');

any idea to solve this?

Hi!

Yes, unfortunately authentication is needed. I just create a user to work with backend scripts (in Component init() function):

if (!BackendAuth::check()) BackendAuth::login(
    BackendAuth::authenticate([
    'login' => 'YOUR_LOGIN',
    'password' => 'YOUR_PASSWORD'
    ]) 
); 

There is a tight binding of the framework to the backend user (I don’t remember exactly). I understand that this is a “crutch”, but the is working.

Incremental
Incremental

Hi, sorry for awaking this old topic.

I'm new to October and I tried to load scripts and CSS in public function onRun() but it doesn't work, the editor is not rendering...

Is something more missing ?

public function onRun() {
    $this->addJs('/modules/backend/formwidgets/richeditor/assets/js/plugins/richeditor.js', 'core');
    $this->addJs('/modules/backend/formwidgets/richeditor/assets/js/plugins/build.js', 'core');
    $this->addJs('/modules/backend/formwidgets/richeditor/assets/css/richeditor.css', 'core');
}

Thanks

Last updated

Linkonoid
Linkonoid

Incremental said:

Hi, sorry for awaking this old topic.

I'm new to October and I tried to load scripts and CSS in public function onRun() but it doesn't work, the editor is not rendering...

Is something more missing ?

public function onRun() { $this->addJs('/modules/backend/formwidgets/richeditor/assets/js/plugins/richeditor.js', 'core'); $this->addJs('/modules/backend/formwidgets/richeditor/assets/js/plugins/build.js', 'core'); $this->addJs('/modules/backend/formwidgets/richeditor/assets/css/richeditor.css', 'core'); }

Thanks

Hi, I'm afraid adding js + css is not enough. Almost all widget logic works through Ajax - server side handlers call out (for this reason I wrote the BackToFront plugin, this not advertising, the task was not entirely trivial, but solved). If you try, you can make individual widgets work without much effort, the main thing is to correctly register the handlers (+ a few more pitfalls will be found along the way). If you are a beginner in October - do not suffer with this question, time is more expensive...

21-32 of 32

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.