On 28/10/2007, Mario Minati <[EMAIL PROTECTED]> wrote: > On Friday 26 October 2007 20:03:59 Ruben Fonseca wrote: > > Hi! I've a question about the "custom error messages" on cookbook. > > > > Following the cookbook (and with the typo fix), it seems to work at the > > first glance. But then I tried this on a real application (pseudo code): > > > > $form->set_constraint_force_errors(1); > > $form->process($request); > > > > if($form->submitted_and_valid) { > > > > } > > > > The problem with this is that on my test, submitted_and_valid continues > > to return 'true' even with the force_errors before. I think this is not > > supposed to happen. Or is there another hack to real enforce the error? > > > > Thank you! > > Ruben > > Hi Ruben, > this should not happen. > > Could you paste some real code.
This is actually the intended behaviour. When I created 'forced' errors, I considered them to be 'display' orientated, and they shouldn't interfere the logic side of things. The current equivalent of what you want, would be: if ( $form->submitted && ! @{ $form->get_errors({ forced => 1 }) } ) { ... } We could maybe change submitted_and_valid() to accept the same arguments as get_errors(), so you could do: if ( $form->submitted_and_valid({ forced => 1 }) ) { ... } Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.rawmode.org http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu