i need to control the numer of characters enter by the user on a single textbox, but i don’t know how, for example y have this
$.validator.addMethod('selectNone',
function(value, element) {
return this.optional(element) ||
(value.indexOf(" ") == -1);
}, "Por Favor Selecciona una Opción");
how can i create a rule that control that the use just enter 6 characters (alfanumeric) and how can i control that the user can enter max a number 999,999,999.99 (i can control that the user if doesnt enter the “,” and my textbox add it when the user finish a number like 55555.55 and transform it to 55,555.55 (the “.” should be always entered by the user if they are going to enter decimals)
thanks
Is this actually 2 questions? how to limit the number of chars and how format what the user has entered.
You can limit the length just in HTML by using the maxlength property on the input element
For the formatting have a look at this question…
Add comma to numbers every three digits
Also – if you’re using JQuery validator http://docs.jquery.com/Plugins/Validation/Methods/maxlength
For the regex – have a look at this question too Insert commas into number string