I don’t know if there is a generic class that will do this for you. It could be done, but these situations are far and few between so I would assume there isn’t.

 

All you would have to do is watch the events on the input element, either keydown or keypress, inspect the length of the target node and if it is 2, then append the forward slash. If you want to restrict the values entered it is easier to just use the charCode/keyCode decrypted to character and check 1-0 with a regular _expression_.

 

…I hope this gives you some direction to start stomping towards.

 

-Andrew Martinez

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Fernando
Sent: Friday, June 16, 2006 9:35 AM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] mask input fields

 

how to mask input fields? like

my mask = '## / ####'

when user type it will put / after the second char . and bla bla bla

have ror a helper for do it? or, someone knows a good js code for it?

tks

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to