I am trying to bring across only the last 6 digits of another field.

  • whiteint
    Asked on June 12, 2020 at 9:04 AM

    I am trying to bring across only the last 6 digits of another field. I am using the formula in the calculation option.

    right (FIELD 0-9,6)

    By setting it as 0-9, it is bring over all numbers from the field. Ideally i am only wanting the last 6 digits.

    Any ideas?

  • Sonnyfer JotForm Support
    Replied on June 12, 2020 at 9:53 AM

    Hi there - What you're trying to achieve is possible via our SubString Widget. The widget allows you to capture a part of the string. Then you can use CONDITION to transfer the widget's value to another field.

    Please refer to my demo form below:

    1591969886ds Screenshot 10

    If this fits your requirement, you can clone it on your account to see how I made it.

    Guide: How-to-Clone-an-Existing-Form-from-a-URL 

    Let us know if you need further assistance.

  • whiteint
    Replied on June 14, 2020 at 8:16 PM

    Hey Sonnyfer, 

    Thanks for your reply, the subsrting will look from left to right. It would be possible to extract the last 6 digits if it's a set number of digits (16 digit card number)


    But this widget does not go right to left.


    Example 

    var res = str.substring(str.length - 1, str.length);


  • Sonnyfer JotForm Support
    Replied on June 14, 2020 at 9:42 PM

    Thanks for clarifying. Unfortunately, that is indeed the widget's limitation.

    Do you plan to embed your form on a website? If so, you can use the form's full source code and apply javascript on it to capture the last 6 digits right-to-left.

    Guide: How-to-get-the-Full-Source-Code-of-your-Form 

    If you need further assistance, please let us know.