I’m wanting to use EForm for a custom search form, where a user can search for a holiday using various fields such as departure date, airport, destination, as well as many others.
Because I’m interacting with a new table, I’ve decided to put everything inside one big library which will sit outside of MODX, and I call one snippet to do the work.
I know that I can use EformBeforeValidation as well as the other custom functions found on the wiki to pre-validate a form, and use a custom function ie:
function formParseEvent( &$fields, &$templates)
Where I can handle all the events, and form validation...
Here’s what I need to know.
1) Inside my formParseEvent function, how do I get EForm to recognise whether a validation error has been thrown, and what exact error it was?
I want to make my formParseEvent do all the validation relating to the user’s query and then make Eform recognise whether a validation error has been thrown.
For example, Lets say a user enters an invalid departure date, how do I make Eform recognise this as an error?