On 09/03/2008, Steve Caldwell <[EMAIL PROTECTED]> wrote:
> In the script below, I'm forcing an error on an otherwise successfully
>  submitted form, using force_errors(), as laid out in the Cookbook.
>  However, after doing so, the form is still returning true when calling
>  submitted_and_valid().  Shouldn't force_errors() result in has_errors()
>  returning true (and thus submitted_and_valid() returning false)?

force_errors is really only intended to affect the xhtml output.

The only way to return them in your code is with get_errors({ forced => 1})
(note that that returns all errors, not just forced ones)
There's currently no way to make has_errors() or submitted_and_valid()
take them into account.

The equivalent to submitted_and_valid() would be:
    if ( $form->submitted && @{ $form->get_errors({forced=>1}) } ) {
      ...
    }

Carl

_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to