On 13/03/07, Tobias Kremer <[EMAIL PROTECTED]> wrote:
> > I propose making it a lot more powerful and flexible, with the following
> > steps:
> > * filter
> > * constrain
> > * inflate
> > * validate
> > * transform
I was just wondering where one would hook in a jQuery (Prototype, Dojo,
whatever) library that makes use of the defined constraints to check
certain aspects of the form on the fly in the clients browser? This
should not be a big deal but a really useful and cool thing IMHO. No
current form library supports this out-of-the-box AFAIK - maybe
HTML::FormFu will? :)
CGI::FormBuilder has a 'javascript' option, which will automatically
generate JS checks which run on 'onsubmit', and show a dialog message
if there's errors.
And I *really* don't want to go down that route!
It means that all regex constraints would have to be pcre-compatible,
so that they can run in JS.
It also doesn't really allow for onblur or onchange checks.
I've still to experiment properly with how best to handle this, but
one of my plans is to be able to force the error markup to be
generated, but with a 'disabled_error_foo' rather than a 'error_foo'
classname.
This will allow the JS to search for elements by that classname,
rewrite the classname if a check fails, and display the error message.
And by setting 'auto_constraint_class', that should provide the hooks
you need to write your own JS checks.
I'm still not sure though of how best to allow some form of JS checks
which can be loaded from the perl code.
Maybe different JS libraries will each need their own perl package for
each constraint.
So, for example, There would be:
HTML::FormFu::Constraint::Dojo::Required
HTML::FormFu::Constraint::JQuery::Required
and then have a setting such as 'auto_js_constraint', which if you set
to 'Dojo' and then add a 'Required' constraint, it'll automatically
look for the 'Dojo::Required'.
Anyway, I'm just making that up as I type it ;)
Still some ways to go!
Carl
_______________________________________________
Html-widget mailing list
Html-widget@lists.rawmode.org
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget