Hi, maybe the following playground code dows what you want:

http://tinyurl.com/33a6kbr

Regards,
Andreas

> -----Ursprüngliche Nachricht-----
> Von: Wojciech Sieczkowski [mailto:[email protected]]
> Gesendet: Dienstag, 4. Mai 2010 16:21
> An: [email protected]
> Betreff: [qooxdoo-devel] Masked textField
> 
> Hello!
> Do you have an idea how to achieve a masked textField? What I want to do
> is to make a text field which will serve as input for registration key
> of known format (like AAAA-BBBB-CCCC-DDDD). I want those "-" to be
> automatically added (or to be displayed all the time).
> What I managed to accomplish is adding "-" signs after every 4
> characters like this:
> 
>       var i = 1;
>       field.addListener("keydown", function(key) {
>               var pos = field.getTextSelectionStart();
>               if ( pos == 5 * i - 1) {
>                       field.setValue(field.getValue()+"-");
>                       i++;
>               }
>       },this);
> 
> But when a user starts to delete characters or inputs something in the
> middle - it gets all messed up.
> What I am lacking is a masked input widget. Anybody has an idea how to
> implement it?
> 
> Wojciech Sieczkowski
> 
> 
> ---------------------------------------------------------------------------
> ---
> _______________________________________________
> 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