How to set number validation and decimal points in a textbox field?

  • lafhab2
    Asked on April 7, 2017 at 7:37 PM

    I have text boxes that are numbers which are used in a calculation, but by default they have no decimal points. I know how to force the end calculation to have 2 decimal points, but I can't find how to make the number entry boxes show decimal points automatically.  Input mask, and validation: currency were the means on the previous version of Jotform, but I can't find these options on this new version.  Even if using a number box as a field, there's no option for decimals or currency?

  • Mike_G JotForm Support
    Replied on April 8, 2017 at 2:13 AM

    We would like to apologize for any confusion. Short Text Entry or textbox field Input Mask and Validation option can be found in its properties under the options tab.

    How to set number validation and decimal points in a textbox field? Image 1 Screenshot 40

    However, if you're looking to show decimal places by default in the output textbox field of a computation, the "Show Empty Decimal" should be enabled.

    How to set number validation and decimal points in a textbox field? Image 2 Screenshot 51

    That option is also available in the Form Calculation widget.

    But if you are looking to make the entered amount of your respondents to have decimals by default, then I suggest you try the Masked Input widget.

    How to set number validation and decimal points in a textbox field? Image 3 Screenshot 62

    I hope this helps. If, in any case, I have misunderstood your concern or I you have any further questions, please feel free to let us know and we will be glad to help you.

    Thank you.

  • lafhab2
    Replied on April 8, 2017 at 5:43 AM

    Thanks for reply, although I had 'short text boxes' there were no such options for currency and input mask, for these the only options I had were width & limit entry.  I am guessing that these options are automatically removed if the field is being used in a calculation, because when I added a next short text box I had those options.  I was also aware of the ability to use decimal points in the end calculation, that was easy.  The validation: currency and input mask unfortunately don't really help, because setting validation to currency doesn't automatically add the decimal point eg '.00' (is there no option to control this?) and input mask doesn't appear to be flexible (the number entered could be between 10 and 4000).  To clarify, what I am wanting is if the user enters a round number, the decimal point and 2 zeros are added, eg '10' is entered which is automatically changed to '10.00' - input mask not only shows an error if the user hasn't entered .xx but also it is strict with the digits before the decimal point and the amount entered.

  • Mike_G JotForm Support
    Replied on April 8, 2017 at 7:24 AM

    Thank you for the clarification, we appreciate it. We will be glad to help further you with your concern. May we just know which form and which field in that form are you referring to, please?

    I'm not sure if what you would like to happen is possible, but I will try my best to check if there are any other workarounds and get back to you as soon as possible.

    Also, have you checked if the Masked Input widget would fit your requirements?

     

    How to set number validation and decimal points in a textbox field? Image 1 Screenshot 20

    Thank you.

  • lafhab2
    Replied on April 9, 2017 at 9:30 AM

    Thanks, the form is https://form.jotformpro.com/70112792695965&auth=24574390 (needs auth code on url to show fields) and it is the 4 'payment' boxes under the heading 'Payment', unfortunately the masked input widget does not help because you have to type in the full number, so entering say 10 would be .10 - I am wanting the .00 to be added automatically to a number after entry, unless .xx has been entered.  As it would appear that calculations are the only number to get .00 added, the only workaround I can see is for there to be an additional hidden box for each of the four payments and a calculation for each, which I just tried and works.  I do however think there should be a basic option for number fields to add .00 where required when a whole number has been added.  Is there another workaround?

  • Kiran Support Team Lead
    Replied on April 9, 2017 at 9:59 AM

    I was actually thinking of the same workaround to have a hidden calculation field with a condition. However, I have also tested using the Calculation widget directly with default decimal value to enter values instead of a textbox field. 

    Let us know if that works for you. Please get back to us if you need any further assistance. We will be happy to help.