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

  • Profile Image
    rollerkingdom
    Asked 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

  • Profile Image
    NeilVicente
    Answered 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
    rollerkingdom
    Answered on September 05, 2012 at 10:54 AM

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

  • Profile Image
    NeilVicente
    Answered 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
    rollerkingdom
    Answered on September 05, 2012 at 12:43 PM

    thanks

  • Profile Image
    NeilVicente
    Answered 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