Hey Matthew,

2011/9/16 Matthew Sherborne <msherbo...@gmail.com>:
> Hi guys,
> Is there a walkthrough or explanation of how to do the javascript object for
> a custom WValidator somewhere ?
> I've looked through the code for WIntValidator and friends, but it seems a
> bit 'only for Wt devs, not for Wt Users' ..

True... The idea is that in most situations you can specialize a
WRegExpValidator and then this is also handled for you by the library.

The short answer is: the javaScriptValidate() method should return a
JavaScript object which has a method validate(text) which returns a
tuple { valid, message }. For examples of such implementations, you
can check the js/*Validator.js files.

> I'm trying to make a validator that'll make sure one password field is the
> same as the other one (when resetting your password), it'd be nice to have
> it handle things in JS on every keystroke
> If anyone knows of an easier/better way of doing it, I'm all ears.

I think using a validator fits well, although you could easily fall
for the short cut by connecting
a JavaScript snipped to the field->keyWentUp() signal.

Or wait until Auth::RegisterWidget is committed to git (after the
imminent release of 3.1.11)

Regards,
koen

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to