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.


  • Profile Image

    Can I add dashes every 4 numbers for credit card number field

    Asked by rollerkingdom on September 04, 2012 at 02:04 PM

    I have a credit card field and I'm wondering if it's possible to put dashes after every 4 numbers so it's easier to read the submission.

    Ex: 2222-2222-2222-2222

    thanks

    Page URL:
    http://www.jotform.com/form/3340538199

  • Profile Image
    JotForm Support

    Answered by NeilVicente on September 04, 2012 at 02:46 PM

    There is a workaround which involves inserting a total of four fields to your form, but that would mean the credit card number would be split into four different fields.

    Another workaround would be to use custom JavaScript to automatically insert the dashes as the numbers are entered. However, this would require the form's source codes to be embedded on an external webpage.

    Let me know if you're interested on any of these solutions.

  • Profile Image

    Answered by rollerkingdom on September 05, 2012 at 10:54 AM

    Hi, I can you tell me how to add the JavaScript? Thanks

  • Profile Image
    JotForm Support

    Answered by NeilVicente on September 05, 2012 at 11:17 AM

    I don't have a JavaScript available yet. I will have to create a custom one that will work for your form.

    I'll get back to you as soon as I have it.

  • Profile Image

    Answered by rollerkingdom on September 05, 2012 at 12:43 PM

    thanks

  • Profile Image
    JotForm Support

    Answered by NeilVicente on September 07, 2012 at 11:50 PM

    Thank you for patiently waiting. Follow the instructions below in order to implement this solution:

    1.  Create a blank HTML page on your server
    2.  Copy these codes onto your HTML page's source then save your page:

    http://pastie.org/4683528

    3.  Copy your form's source codes ( Setup & Embed > Embed Form > Source )
    4.  Paste the form's source onto the codes you have copied from Step 2.
    5.  Find this line on your form's source:

    <input type="text" class="form-textbox" id="input_12" name="q12_creditCard12" size="30" />

    6.  Add onBlur="dash()" before the input type's end so it becomes:

    <input type="text" class="form-textbox" id="input_12" name="q12_creditCard12" size="30" onBlur="dash()"/>

    7.  Save your webpage