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

Christopher H. Laco claco at chrislaco.com
Mon Mar 13 18:26:57 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.
> 
> You can see it at:
> http://search.cpan.org/~nilsonsfj/HTML-Widget-JavaScript-0.01/
> 
> There's also a companion Catalyst plugin at:
> http://search.cpan.org/~nilsonsfj/Catalyst-Plugin-HTML-Widget-JavaScript-0.01/
> (This plugin shouldn't need further updates as the main module evolves)
> 
> When all of this gets into a reasonable "trustable" level, it could
> maybe get into the main HTML::Widget distribution.
> 
> So... any comments?
> 
> -Nilson Santos F. Jr.

While I haven't scoured the source yet, ++ for putting forth the effort.
I'm a big fan of having validation on both sides of the fence
(server+client).

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060313/f2bce78b/attachment.pgp 


More information about the Catalyst mailing list