Count digits in number to multiply for a cost?

  • jenebo
    Asked on September 14, 2015 at 11:54 AM

    For example, we have a badge number 10150. Instead of Jotform reading it as 10,150, we would like it to count the numbers so it should read the number 5 for the 5 digits, then we can multiply the 5 digits by the $1.25 per digit for a total. Is there a way to do this?

  • Charlie
    Replied on September 14, 2015 at 3:30 PM

    Hi,

    May we know how the badge number is generated? Is it being typed on one text box field? Or is generated by clicking radio buttons or check boxes? I believe the conditional logic should be able to do this, but depending on how you setup things.

    This can be also be done by adding a custom Javascript code in your form's full source code to count the numbers. Here's a Javascript function that does that: http://www.w3schools.com/jsref/jsref_length_string.asp.

    We'll wait for your response.

  • jenebo
    Replied on September 14, 2015 at 4:12 PM

    The badge number is typed in by the user.

  • Chriistian Jotform Support
    Replied on September 14, 2015 at 11:34 PM

    Hi,

     

    As suggested by my colleague, you can achieved this by adding conditions in your form. You can check this sample form that I have created - http://form.jotformpro.com/form/52568689768986. See screenshot below for the Condition setup of the form I implemented.

    Count digits in number to multiply for a cost? Image 1 Screenshot 20

     

    Do let us know if you need further assistance.


    Regards.