-
- 406 Posts
Am I using an incorrect error placeholder??
I have [[!+fi.error.math]] and Formit 2.0.3 installed on MODx 2.2-pl2 traditional.
Entering a wrong math answer shows no error message, how to fix this??
Thank you, Tom
-
- 659 Posts
Hard to answer if you don't show your code...
Cheers
-
- 659 Posts
Hi,
I believe you have to put the hook 'math' before the hook 'redirect', as Formit process them in the order you invoke them, the math hook is not fired since the redirect is fired before it (and redirect the user to your resource 27)
Hope this helps
Cheers
-
- 406 Posts
Unfortunately that does not fix it.
The only error that does work is if the math field is blank which displays the 'this field is required' error message.
I'll check the bugs site too...
Thank you, Tom
-
- 659 Posts
Hi Tom,
(May be it's a bit late to anwer) This behavior is normal...
'math' is a hook (it's fired AFTER validation) and don't have fallback to return an error message on the form.
If you want to display an error message if the answer is wrong you have to write a customValidator that will check if the input value is correct...
Subtle difference between HOOKS and VALIDATORS... Validator check one or more conditions and returns on the form with error message since the condition(s) is right.
HOOKS act only after validation, assuming your form has been submitted and all goes fine with the posted values... Then you can do any processing you want with these values...
As the hook 'email' sends an email (and don't return error if it fails in this task) with the value you specify it does not check if the email is well formatted... To add to confusion there is also a built-in validator called email which is in charge of validation (check if the email is well formatted).
Hope this helps
Let me know if you have any problem
Have swing
-
- 406 Posts
ahh...wrong answer validation is not built into the hook...thank you...
any suggestions about custom validators for wrong answer??
Thank you, Tom
-
- 406 Posts
This requires a separate forum thread, which I'll do now...
Thank you, Tom
-
- 89 Posts
Hi Tom
I realise this thread has long since closed but I'm having the very same problem here now.
I've tried tracking down the new thread you mentioned you would start but without success.
Did you manage to remedy this in the end?
I do realise the passage of time may be an obstacle in itself
but many thanks anyway.
Regards
Chris