The html() method "returns the HTML serialization of the field, along
with the HTML error message, if any."
http://search.cpan.org/dist/Rose-HTML-Objects/lib/Rose/HTML/Form/Field.pm#html
An error message will only exist, however, if validate() has been called.
My guess is that you are re-using form objects that were validate()d
in an earlier request. Re-using form objects is fine, and in fact
recommended, but you must be sure to reset() (or clear(), I suppose)
the form before each use.
http://search.cpan.org/dist/Rose-HTML-Objects/lib/Rose/HTML/Form.pm#reset
http://search.cpan.org/dist/Rose-HTML-Objects/lib/Rose/HTML/Form.pm#clear
This whole process (reset()ing forms, calling validate() on
submission, etc.) is best handled by integrating this flow into your
web application framework.
-John
Thanks for your prompt reply John :)
One more question though. Validation takes place on individual fields
right? Suppose on a form I have constraints where one field is
dependent on another field (ie: date of birth must be specified if
user wants to join our 'birthday sweepstakes' for instance). Do I
override validate() on the form object and perform the validation
there?
Also how do I tell the 'date of birth' field to return a fail
in such a case, since the validate method for that field would be
independent of the 'birthday sweepstakes' field.
Sorry if the example seems a bit vague, that's something that just
rolled off the top of my head :)