Phone Number Format

I have a phone number field typed as VARCHAR in my database. I’d like to have a format that permits the user only to enter numbers in this field. I’ve noticed the use of ‘#’ as a format mask for numbers, however if I use it I will be forcing the user to enter the exact number of digits defined by the quantity of # (i.e. ### == 777, not 77 or 7777).

I would like the phone number field to behave just like if it was an Integer the dataprovider behind it.

Any Suggestions?

Thank you.

You can use a pipe (|).
All in before is the format, all after is for entering the data. You can leave that empty and the user can type whatever he/she wants.

The use of pipe (I) doesn’t work in this case. For example, I tried to use the formats ‘#|’ and ‘########|’. The first only allowed me to enter one digit max when the second forced me to enter 8 digits at least. I want a format where I can enter as many digits I want [0-9], only limited by the length of the database column.

It is something like in regexp: [0-9]*

Thank you very much for the attention, I appreciate if you or someone can help me again.

Hi Juliano,

I think the easiest option is to create a method like this:

function onDataChangePhoneNumber()
{
	var _new = arguments[1];
	phonenumberfield = _new.replace(/[^0-9]/g, "");
}

and put that on the onDataChange of your phonenumber field.