What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
can I add script to my form that will automatically add hyphens in between the 3 digit area code and also the 3 digit prefix?Asked by pauljmiller on February 27, 2011 at 12:28 PM
I would be happy to use either the quick tools phone number box or a plain text box added from the form tools.
my email is email@example.com thank you very much
Yes, you can add script to your form but not within the options of JotForm. You can copy the HTML source of your form and put it in your website. Or download the zip file.
On the "Share Form" wizard, click on "Advanced Options" and then click on "Download Zip".
f.value = f.value.slice(0,3)+"-"+f.value.slice(3,6);
While in the textbox that you wish to use this script, add: onBlur='addDashes(this)'
example of textbox:
<input id="input_4" class="form-textbox" maxlength="10" name="zipcode" size="15" onBlur='addDashes(this)' />
What this will do is for every 6 numbers you enter in the textbox, it will insert a dash in between the 3rd and 4th number.
Note: just make sure that in your JotForm, there should be no numeric validations in it, otherwise jotform will return an error on your textbox.
EXACTLY what I needed! Short and sweet. Thank you!
for me this puts a dash after the first three numbers and deletes the last four numbers. giving me for example " 123-456 " but i had typed in 1234567890
This is an old thread. But for the purpose of updating everyone, there is an easier way to do this now -- On the form builder (editing your form), simply select the text box and click on the Input Mask icon, and set your desired input
Another update is on the input mask on the phone number field itself. You can set the 2-textboxes phone number field to become a single phone number field by enabling the Input Mask and then you can also fix your own prefern mask value.
Hello Rob, I've created a separate thread for you here https://www.jotform.com/answers/887056 We'll have your question answered there shortly