Page 1 of 1
Number field in forms
Posted: Tue Sep 22, 2020 10:27 am
by trevorm
I have created a form on a page that requires the user to add a number in a field (set to Number field type ) with up to 2 decimal places. However, when published the field only allows whole numbers. I cannot see how to set the field to accept 2 decimal places
Should I use a different field type for this?
Thanks
Re: Number field in forms
Posted: Tue Sep 22, 2020 10:29 am
by Pablo
There is no standard solution for this in HTML as far as I know. This requires a custom script.
Re: Number field in forms
Posted: Tue Sep 22, 2020 10:37 am
by trevorm
Hi Pablo,
Thanks for your reply.
When I test the page in Preview mode locally it works with decimal places, it just does not work when published online, why is that?
Re: Number field in forms
Posted: Tue Sep 22, 2020 11:10 am
by Pablo
There is no difference between the published HTML and local preview.
Maybe you did not publish all files?
Re: Number field in forms
Posted: Tue Sep 22, 2020 4:53 pm
by BaconFries
What does html of the input field look like?. What are the settings?
Re: Number field in forms
Posted: Tue Sep 22, 2020 6:12 pm
by wwonderfull
If I am not misunderstanding then may be this can help:
After that for validation this is extremely important:
THIS WILL LOCK THE NUMBERS IN DIGITS AND USER CAN NOT LEAVE THIS AREA BECUASE IT IS CHECKED "DATA REQUIRED" MIN 1- MAX2 NUMBERS. BECUASE THE "DIGITS" ARE CHECKED ONLY NUMBERS CAN BE WRITTEN HERE NO TEXT CAN BE ENTERED.
If still it does not help please give a demo project and I will try to understand better.
Re: Number field in forms
Posted: Thu Sep 24, 2020 2:47 pm
by trevorm
Thanks for your input
I think "Max Length" refers to the overall length of the number. In fact the Number field type only displays whole numbers it appears, no digits following the decimal point. Although is does work in preview mode on my pc, it does not work online. I am uploading all pages and have even deleted all pages before uploading still with no change.
Re: Number field in forms
Posted: Thu Sep 24, 2020 3:47 pm
by BaconFries
I think "Max Length" refers to the overall length of the number.
You are correct with your thinking. Please try one of the following highlighted in
red To insert ither right clickl on the Editbox->Object HTMl->Insert Tag. Please let me know if this helps...
<input type="text" id="Editbox1" style="position:absolute;" name="Editbox1" value="" spellcheck="false"
step="0.2">
<input type="text" id="Editbox1" style="position:absolute;" name="Editbox1" value="" spellcheck="false"
pattern="^\d*(\.\d{0,2})?$" >