Back to Back To Front Support

ladushki
ladushki

Hi, thank you for the plugin. I am building a complex form and trying to use a repeater inside the nestedfrom. The add subitem button is rendering, but after I click on it I am getting a missing AJAX handler onAddItem error: AJAX handler 'formSubstancesnestedformOthers::onAddItem' was not found.

The case works in backend.

Something like: substances: type: nestedform form: fields: name: label: name type: text others: type: repeater prompt: Add new subitem form: fields: name: label: name type: text

Last updated

Linkonoid
Linkonoid

Hi, Thank you for use plugin! It is difficult to say what the problem is and whether it is solvable. To understand the mechanism: the plugin convert all handlers of the form "widgetAlias​​::handler" to the "componentAlias​​::handler" at the PHP level. Most likely, in your case there is no replacement of "formSubstancesnestedformOthers::" with "componentAlias​​::" at the Html and Js level of the button (with a probability of 99%, a handler of the form "yourComponentAlias​​::onAddItem" exists). For the sake of cleanliness of the code, I refused to use the post-processors of the page or replace the original JS-code to fix similar errors of nested elements (this is also found in Relation when searching, but not critical for work). The task is not entirely trivial, I will try to reproduce your situation and find some solution.

Last updated

ladushki
ladushki

Hi, thank you for your answer. There is one more issue due to the binding of the handlers. If you use multiple fileuploads in the form, they all call backtofront::onUpload and as a result, the last field name is used for all of the fileupload widgets.

Linkonoid
Linkonoid

Yes, the behavior is quite logical when there are several elements of the same type in the form with the same server-side handler (in your case "backtofront::onUpload"). I'll think about how to get around this problem (change handler name for this? technically possible, but post-processing of the page with change Html-Js is required... it will significantly affect performance).

Theoretically, these widgets can be taken out into separate components and added to the page (as is the case with the MediaManager component) by writing separate aliases for each upload (but this will not work in the form ... and the processing will need do it manually, not in "auto mode"...).

Last updated

1-4 of 4