[Catalyst] RFC: HTML::Widget::JavaScript

Matt S Trout dbix-class at trout.me.uk
Mon Mar 13 18:54:56 CET 2006


Nilson Santos Figueiredo Junior wrote:
> I'm not usually very fond of sites where all the validation is *only*
> done at the server.
> This provides, IMO, a lousy user experience.
> 
> However, I'm also sane enough to acknowledge that some sites out there
> that leave it to the client to do all validation and verification were
> obviously made by lousy coders. But client-side validation *does*
> provide a more seamless user experience.
> 
> HTML::Widget provides a well-defined constraint system for each of the
> user-editable fields, so I thought it wouldn't be that hard to make it
> also emit some JavaScript constraint checking code. And thus came
> HTML::Widget::JavaScript.
> 
> Right now it's pretty basic. It implements most of the existing
> constraints in JavaScript but the error handling is still very crude
> and non-customizable (when the form is submitted, if some constraint
> fails an alert box pops up with the constraint's "message" attribute).
> But it suited my temporary needs. And it's done in such a way that if
> the client has JavaScript disabled or something like that, it just
> doesn't get into the user's way and rely on the server to handle
> validation (as it would).
> 
> I decided that although the JavaScript code generation seems a bit
> hackish (I actually don't know if it really is, but it sure seems to
> be), it was CPAN worthy. But I am now asking your opinions about it
> and/or how could I improve it. Or if this idea is completely rubbish
> and I should ask the CPAN indexer to delete them immediately.

Have you considered bootstrapping by using one of the form validation JS 
packages off JSAN? I believe beppu put up a demo of the iusethis login form 
redone using his Data.Form.Validator dist.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list