Hi,
When customers are odering items from us and fill up the form for their info Shipping and Billing, is there a way to force the formatting of the phone number to be
(000) 000-0000 ?? no matter what they type in
examples of what customers are typing in when ordering from us
1111111111
111.111.1111
111.111-1111
111 111 1111
we have to export our orders to another off line application and are looking to standardize this field.
Thanks,
sraza
Wow. amazing…54 people read the question…not a single answer??
Sounds like you want a javascript that will test the input field with regular expression and either (a) remove all non digit characters (which would be my preference) or (b) enforce phone number formatting as they type.
The thing I like about (a) is that you can then take that plain set of numbers and used string functions to display it however you want.
Javascript and smarty don’t always play nice - either link to the script from an external file or use the {literal} tags around any jscript you add to the template file.
There are lots of free script snippets out there that will take the current value of an input field and return a formatted result with every keystroke - it generally gets called from the onchange handler.
I´ve used a easy solution. Create a own field like “Telephone” with type inputfield, also customer can write the number without formating. sorry for my english