-
☆ A M B ☆
- 1,031 Posts
I have written a custom captcha and facing now the following problem:
The captcha is called as preHook (because it has to display the captcha) and if not successfull the preHook is calling addError and returns with false. This error seems not to be mentioned later in the form process (i.e. by validate hook or FormIt itself), so the form is posted even with the error in preHook. Is that a bug or a feature?
-
☆ A M B ☆
- 1,031 Posts
Thanks for your answer. This was my first solution to solve that problem, too.
But if i look in the code of firequest.class the function runPreHooks is called every time in request->prepare and just $fields is not set if the form is submitted. So if later in request->postProcess the function runPostHooks is called, the result of $this->formit->preHooks->hasErrors() could be retreived and $success = false could be triggered for this case too.
So the snippet does not have to be called twice as pre and post hook. Maybe that would be accepted as pull request.