How to limit the decimal place of a field?

  • indoorsmanufacturing
    Asked on July 7, 2021 at 5:05 AM

    How can I have a text box field or number field to only accept inputted numbers to one decimal place before I do a calculation?

  • esraari JotForm Data Scientist
    Replied on July 7, 2021 at 8:09 AM

    Hi,

    You can use the Input Mask feature inside of the Short Text element. The following steps may help you with this.

    Step 1: Drag and drop the Short Text element to your form

    Step 2: Click Properties

    Step 3: click OPTIONS from the opened sidebar

    Step 4: arrange your text format in the Input Mask field.

    PS: use # for masking numbers whereas @ for Letters. In your case, I believe you will only use the numbers which is #. Also, as a separator any special character you can select like comma or point.y yOx52ZDhJm9YO934IVWfovvOe8k9rlw25O8NPi Screenshot 10

    Let’s test it. For your use case, I preferred to use a full stop(.) as a separator and put only one hash(#) to indicate the number. Here how it works. zklA6O6J47z0e fm2QuyOxWnR0vfNnM3GHjqAMrK Screenshot 21

    If you require any further information, please don't hesitate to reach us!

    Thanks for using JotForm.



  • indoorsmanufacturing
    Replied on July 7, 2021 at 10:23 AM

    I have the case where a user may type in numbers like the following. 2150.5 or 350.5 or 56.5 how can this be done.

    So it could be a 5 digit, 4 digit of 3 digit number which includes the full stop that may be entered by the user.

    I tried what you suggests but that only work for one situation with exact number of digits.

    is there another solution?

  • Basil JotForm Support
    Replied on July 7, 2021 at 1:48 PM

    Hi,

    There isn't any other way to limit the decimal places entered in a field.

    It is possible to limit the decimal places for the data appearing on your submissions page by adding a calculation field and limiting it to one decimal place but the user will still enter as many decimals as they wish.

    1625680032 60e5e8a022da3 chrome lpODDtAM Screenshot 10

    1625680041 60e5e8a9ef596 chrome lJiHve0m Screenshot 21

    1625680079 60e5e8cf9018e chrome H67NvhoQ Screenshot 32

    Please let us know if you require any further assistance.