terminal42/contao-mp_forms

Hidden fields are not set in $_SESSION['MPFORMSTORAGE'] by Contao 4.6.6 and MP-Forms 3.0.8

Closed this issue · 3 comments

I am working on a multipage form and using this extension version 3.0.8 with Contao 4.6.6.

What I am doing:
I use a few custom fields (HTML-Code) that I override with jQuery and pass them to the hidden fields (i change the values and put it on hidden fields).
The form has 4 steps and I want to display the entered data in step 3 before the form sent.
I read the issues and saw that this issue is already open #21
The Problem:
Now I'm using $_SESSION['MPFORMSTORAGE']['formID']['steps'] to see the pasted data, but the hidden fields are empty.

Result:
These value from hidden field are unfortunately not available. If I use input type text instead of hidden fields, then the values are available.

It' is a bug or is this extension not compatible with contao 4.6?

Thank you very much for your support.

That doesn't sound like a bug. You cannot add custom <input> fields using HTML. Contao will ignore them. They have to be real widgets in the form generator. Contao is ignoring all data that's not handled by any widget.

I thing you didn’t understand the situation.
I know that contao not handle the custom html fields. I am using the html field just as placeholder, because I must change the value of this fields via JS. I have also the contao hidden fields as regular contao widget. I insert the value from my custom html field to the hidden field via JS. And if I send the form the values of hidden fields are not passed in session.

I cancel the multi page form. Use contao regular form and the values of the hidden fields are passed in session.

As I told you, the custom html fields are dummies, because the contao select field options is not possible to change with JS. The values are in database and contao check the selected value by submitting. But the custom html select field is not in database and you can move the value to hidden field by change, so contao can handle the value of hidden field and ignore the custom html select.

Now if I use text fields instead of hidden fields and hide it via CSS, so i can see the value in session.

This means that the hidden fields can not be passed with multi page form.

I hope it is understandable.

No it's not. If you use regular form fields, it will work. You can use 200 000 lines of JS, as long as the POST request turns out to be the same as if there was no JS, it will work :)