[jQuery] Re: Masked Input Optional Characters
Well, the whole idea of masking the input is to validate it. If you want your user to be able to input 9_ and 09 and _9 and have them all be valid, then you probably should use server side validation, or maybe the validation plug-in. Really, though, what you want to be accepted in the field isn't validation, it's lack of validation. Why not just put a 2-character field and let them fill it in how they please and check to see if it is a number between 1 and 12? Regards, Eric On Jan 25, 11:24 am, Jason Levine [EMAIL PROTECTED] wrote: Is there any way to have aMaskedInputhave optional characters? For example, if I have a month field, I would want to allow 01, 02, 03, etc, but also 1, 2, 3, etc. If I define the mask as 99, then it blanks out the field if the leading zero isn't added. I even tried defining my own placeholder as: $.mask.addPlaceholder('@',(1|2|3|4|5|6|7|8|9|0)?); But that still only matches 0-9 and not a blank character. Any ideas? -- View this message in context:http://www.nabble.com/Masked-Input-Optional-Characters-tp15091355s272... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Masked Input Optional Characters
Actually, what I think I'm looking for is more advanced masking/validation. I want to encourage users to use 2 digits for month, but recognize that using one digit will be valid also. Perhaps a plugin where the value of the field is matched against a regular expression. If it doesn't match, some error message occurs. If it does match, then it is allowed to pass. Come to think of it, maybe I'll just write the plugin myself. -- View this message in context: http://www.nabble.com/Masked-Input-Optional-Characters-tp15091355s27240p15160774.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Masked Input Optional Characters
Jason, Based on your response I would recommend allowing the user to enter either format using the watermark plugin to suggest the format of the input, then if they enter it lazily (ex: Month 9) when they tab out of the input box, correct their format. The reduces any server side validation and gives a visual indication to the user what the correct input format is. ~Sean On Jan 29, 2008 9:23 AM, Jason Levine [EMAIL PROTECTED] wrote: Actually, what I think I'm looking for is more advanced masking/validation. I want to encourage users to use 2 digits for month, but recognize that using one digit will be valid also. Perhaps a plugin where the value of the field is matched against a regular expression. If it doesn't match, some error message occurs. If it does match, then it is allowed to pass. Come to think of it, maybe I'll just write the plugin myself. -- View this message in context: http://www.nabble.com/Masked-Input-Optional-Characters-tp15091355s27240p15160774.html Sent from the jQuery General Discussion mailing list archive at Nabble.com .