Thank you.
This reply helped lot to Validate Float.
Nick Glencross-2 wrote:
>
> Hi David,
>
> johnl wrote:
>> Does anyone have an example of how to use a validator with textfield?
>> Specifically I'm interested in validating floating point numbers.
>
> The validation system is quite neat and attaches a callback function to
> a textfield to perform the check. For instance, you could use parseFloat
> as the basis of a routine to check the value.
>
>
> Another approach is to use a Regular Expression:
>
> var validator_cb =
> qx.ui.form.TextField.createRegExpValidator(new RegExp('^\\d+'));
>
> (I know you said you wanted to check for floating point numbers, but
> wasn't sure where you needed 'e' notion etc. There will be many REs on
> the web)
>
> In both cases you then associate the function with the text field.
>
> field.setValidator(validator_cb);
>
> Later you call isValid on the text field to validate it. What I then do
> is something like
>
> field.setBackgroundColor("#FFc4c4");
>
> if is doesn't pass.
>
>
>
> Hopefully that should get you a bit further forwards,
>
>
> Regards,
>
> Nick
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
--
View this message in context:
http://www.nabble.com/Using-a-validators-with-textFields-tp11183441p16315780.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel