validation notEmpty with condition fails if element is hidden ?....

lcollong

FabriKant d'applications web
Hi,

I've the following setup:
A multigroup form (all in one page) displayed from a menu item (not popup).
A specific element at the beginning (checkbox) allows to choose which group will be displayed or not (on load as this element is prefilled from the url).
Hence, some elements on which I set a "non empty" validation could be hidden.
So, I added a condition on these elements :
PHP:
$choix = explode(',','{___choix_raw}');
return in_array('compl', $choix);
where "choix" is the initial checkbox element saying which element would be shown or not.

It works with a regular form (validation on submit) but doesn't on a ajax / must validate one (validation on each element).
The validation is triggered on the hidden elements which prevent to save a "valid" form (from the UI point of view) despite the condition.

Is this a known limitation (however the hidden elements seems to be present in the DOM) or some site specific situation ?
 
Pffff....
Why make it complicated where it could be so easy....
My brain should be coronavirused !
Thanks Troester for pointing me on this one. That should work indeed....
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top