Modx Evo eForm Throws Constant Validation Error On Select Options Created Using Snippet

Having to add a new form to an old Modx Evo site threw up a bug with the eForm add on today, when submitting the form I was constantly told I had an ‘Invalid Data Error’ on my dropdown field.

I tried every combination of validation settings using the ‘eform=…”‘ attribute to no success, and even when I totally removed the eform options on the select tag I still got the error.

Investigating further I discovered the form works perfectly when the code generated by the snippet populating the options of the select tag was hardcoded in, so the error was being caused by the form being rendered before the snippet had loaded.

To solve this quickly I added the following to the validateField function in the eform snippet:

if($fld[0] === 'trainingdate'){ return true;}

Leave a Reply

Your email address will not be published. Required fields are marked *