OK, didn't test it in other browsers... What about this solution?
http://tinyurl.com/3yjpkft Regards, Andreas Von: Guilherme Aiolfi [mailto:[email protected]] Gesendet: Dienstag, 4. Mai 2010 21:36 An: qooxdoo Development Betreff: Re: [qooxdoo-devel] Masked textField I tested it in chrome 5 dev and it doesn't work as well as it does in firefox. The caret is not in the same position after inserting the "-" char. On Tue, May 4, 2010 at 3:28 PM, Fink, Andreas <[email protected]> wrote: 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 ------------------------------------------------------------------------------ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
