Hello Monika,
have you seen that we are working currently on form validation? Maybe  
that could be something for you... at least it could offer a easy and  
consistent validation.
See the following example:

var textField = new qx.ui.form.TextField();
textField.setInvalidMessage("Please enter a number between 0 and 100.");
this.getRoot().add(textField, {left: 10, top: 10});

var manager = new qx.ui.form.validation.Manager();
manager.add(textField, function(value, item) {
   return value <= 100 && value >= 0;
});

textField.addListener("blur", function() {
   manager.validate();
}, this);

You can give it a try in the online playground: 
http://demo.qooxdoo.org/devel/playground/
But that validation classes are only available if you are working on  
trunk and not on a stable release.

Best,
Martin


Am 22.07.2009 um 15:31 schrieb <[email protected]> <[email protected] 
 >:

>
> Gene, no I need to use text field cause this needs to be filled by  
> user and needs to be proper percentage value (that is why I need  
> validation).
>
> Martin, thanks for your explanation, now I understand how this is  
> happening.
>
>
> S pozdravem / Best regards,
>
> Monika Falk, Software Specialist
> Tieto
>
> Message: 1
> Date: Wed, 22 Jul 2009 08:17:33 -0400
> From: Gene Amtower <[email protected]>
> Subject: Re: [qooxdoo-devel] Problem with focus in text field
> To: qooxdoo Development <[email protected]>
> Message-ID: <1248265053.4319.276.ca...@pcb-bench-01>
> Content-Type: text/plain; charset="us-ascii"
>
> Instead of using a textfield, maybe you could use the spinner widget  
> with the min set to "0" and the max set to "100".
>
> Have you looked at that widget for this purpose yet?
>
> HTH,
>
>   Gene
>
> On Wed, 2009-07-22 at 13:43 +0200, Martin Wittemann wrote:
>
>> Hello Monika,
>>
>>
>> as i tried your example in the playground, i hav seen it working
>> clicking out of the widget the first time. But when I click the  
>> second
>> time, the focus is lost. Thats because of qooxdoo's  property system.
>> You registered the listener, which sets the focus back to the
>> textfield, on changeValue. But as the value did not change the second
>> time, the focus is lost.
>> You could use the blur event to get your code working:
>>
>>
>> this.__percentageTextField.addListener("blur", function() {
>>  if(this.__percentageTextField.getValue() > 100){
>>    this.__percentageTextField.focus();
>>  }
>> }, this);
>>
>>
>> But the whole scenario looks like you could need some kind of
>> validation, right?
>>
>>
>> Best,
>> Martin
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to