terminal42 / contao-conditionalformfields

Display form fields conditionally in Contao Open Source CMS
MIT License
18 stars 13 forks source link

Field value does not evaluate of following page (mp_forms) #87

Closed Shoekrates closed 3 months ago

Shoekrates commented 4 months ago

Hi, it seems that I run into a similar problem like in https://github.com/terminal42/contao-conditionalformfields/issues/69 in combination with mp_forms. Contao 4.13.37 PHP 8.1.27 contao-conditionalformfields 3.1.0 contao-mp_forms: 5.1.2

I have a checkbox on page 2 of my form that I want to evaluate with a conditional field on page 3. But JS Console says that the variable is not defined, whereas if I take off the pagebreak between page 2 and 3 everything is working fine.

If I set the value of the checkbox (page 2) to the standrad value of a normal input field on page 3 via inserttag than the value gets displayed correctly and I can set a condition reegarding the new field. But switching back to page 2 and changing the checkbox and coming back to page 3 does not update the input field value.

Any ideas?

aschempp commented 4 months ago

No idea. Maybe mp_forms does not transmit not-selected checkboxes? Would be great if you (or a developer of your choice) could investigate this and provide a solution 😊

zonky2 commented 3 months ago

CFF works with JavaScript and this can only "see" the fields that are available on the current page...

You can also insert a hidden field into the MP_Forms page, which dynamically has the value from the previous page or you can extend the JS with an array with the values from other MP_Forms pages, which is included in the check of the conditions at first.

You have the same problem if you work with https://github.com/oveleon/contao-advanced-form

zonky2 commented 3 months ago

I have seen that the values from previous pages are stored as a data attribute in MP_Forms - in my opinion there was a small bug that has now been fixed #88

aschempp commented 3 months ago

this should be fixed in 3.1.1