function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AncaDAncaD 

InputText for a numeric field shows blank on the screen but its value is actually 0

I need to validate the value of an InputText, which stores a number type field, i.e. if it's blank or null  I need to show an error message: 'you have to enter a number between 0 and 100'. The problem is that the value of the field seems to never be null or blank, although on the page looks like it is. Its value is actually 0, so I can't use the "field to be < 0 or field == null or field == '' as a criteria to show the error message.

 

How can I prompt a user to enter a value greater or equal to 0, when the field shows nothing on the screen and they click on Save (and the value of the field is actually 0, but they don't see it)?

 

 

Thank you

bob_buzzardbob_buzzard

A couple of ways spring to mind :

 

(1) Use some javascript that won't allow the form submission to complete if the input text component doesn't have a numeric content.

(2) Use a text field to back the input text, and convert this to a number server side.