[html-formfu] output all possible errors in the form to provide javascript hooks (ajax)

Yann Kerherve yann at cyberion.net
Mon Jul 28 03:01:46 BST 2008


Hi,

For some of my input fields, I'd like to setup an ajax "uniquifier" on the
onblur() event. That would be a nice way to warn the user preemptively that
a user name is taken for instance.

My only problem is to give the error feedback to the user in a nice way with
form-fu. What would be nice is to just reuse the error class that my
server-side constraint is firing up if my form doesn't validate. But
unfortunately I've found that the html for the errors are only generated
when the form errors are processed.

Ideally I guess I'd like to have a way to force all the errors to be
rendered with a class=3D"dormant" (display: none) by default. That set, my
javascript could just change the class of the error if the user name is not
unique, and I would only have one validation logic and one error message and
class to render in the html.

The only easy way I've found so far to emulate this is to just define
manually another html bit outside of these errors, which has annoying side
effects: duplication of the message and it's not easy to place correctly in
the form (at least with my skills).

Do you know another way to achieve that? Any pointer on how to modify htmlfu
to do that I described above and if that would be complex or not?

Thanks,

Yann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20080727/d1=
7b253e/attachment.htm


More information about the HTML-FormFu mailing list