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

    How can use the last 3 digits of the provided phone number as the unique ID

    Asked by ikhwanasli on October 20, 2015 at 12:25 PM

    what if i use text box for input phone number.  how can i collect the last 3 digits of the provided phone number? 

    http://form.jotform.me/form/52924533034451

  • Profile Image
    JotForm Support

    Answered by Boris on October 20, 2015 at 12:58 PM

    I'm afraid that still the only solution is to use your form's source code, and add a custom script inside the source code of your form. The script you would need to add to your source code would be similar to the one my colleague used in the previous thread:

    <script type="text/javascript">

    function populateId() {
        var phone = document.getElementById("HTML-ID-of-your-phone-field").value,
            converted = phone.toString();

        if (phone != "") {
            document.getElementById("HTML-ID-of-your-Unique-ID-field").value = converted.substr(-3, 3);
        }
    }

    </script>

    You can get the proper HTML IDs of your fields by following this guide: How to find Field IDs & Names. If your phone field is the one named Nomor HP on your form, and your unique ID field is the one named 3 Digit HP, you would adjust that script with the proper HTML IDs:

    <script type="text/javascript">

    function populateId() {
        var phone = document.getElementById("input_4").value,
            converted = phone.toString();

        if (phone != "") {
            document.getElementById("input_6").value = converted.substr(-3, 3);
        }
    }

    </script>

    You also need to add onkeyup="populateId(); to the field where your users would be entering their phone number. So if you were collecting phone numbers in the field named Nomor HP on your form, you would need to replace this part of your form's source code:

    <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_4" name="q4_nomorHp" size="60" value="" />

    with this:

    <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_4" name="q4_nomorHp" size="60" value="" onkeyup="populateId(); />

    I hope this helps. Please let us know if you need further assistance, and we will be happy to assist.

  • Profile Image

    Answered by ikhwanasli on October 20, 2015 at 09:28 PM

    Ok thats Great. But im stil confused where i must copy that script. im using blogspot. am i must copy thats script before </body> or before </head> on blogspot template?

  • Profile Image
    JotForm Support

    Answered by Boris on October 21, 2015 at 04:02 AM

    The script can be anywhere - you can place it before the ending </body> tag on your website.

    The script must only be on the same page where the source code of your form is used.

    Please let us know how it goes.