I see that as of 0.546, form validate() calls get passed to sub-forms by
default,

   * Added a cascade parameter to validate(), which defaults to true.
     (Suggested by Guillermo Roditi)

Which is great - exactly what I needed! But there is an order-of-operations
problem for me, because validate() calls the sub-form validation before it
calls the per-field validation. If my form validation routine says

$self->field('password')->error('Password and confirm do not match');

then it will be overwritten immediately after by the per-field validation,
which unconditionally sets

$self->error(undef);

on every call.  Is it possible to a) Perform the field validation before the
form validation or b) avoid wiping out existing field errors on every call
to field->validate()?

I do know that form-level validation in practice should (by convention) be
writing errors on the form level, not the field level, but the field-level
errors give me flexibility in my layout template so that I can display
errors relatively close to their respective fields.

I have added this to my base-class, but it seems like a nasty workaround

sub validate {

 my($self, %args) = @_;

 my $ok = $self->SUPER::validate(%args);

 unless ($ok) {
   $args{form_only} = 1;
   $self->SUPER::validate(%args);
 }

 return $ok;
}


Cheers,
DW
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to