Numeric Field Decimal Limit - Forum

Forum Navigation
You need to log in to create posts and topics.

Numeric Field Decimal Limit

Hi.

I have a numerical field limited to 4 characters. So 2.47 by example is OK but 2.477 would not be.

What I have noticed is that the field entry just goes blank if more than the limit entered after you proceed to next screen and return to view the entry, but no error is captured or can be displayed. You are able to enter more than the allowed limit and seemingly no way of capturing the error.

The field variable is neither a zero nor blank text so also cannot be captured with an if statement on checking its status after entry.

Is there a way of preventing the extra decimals being entered? Java script for the field to correct to 2 decimals would be perfect. Or just capturing that the field is beyond the limit allowed.

Thanks

Uploaded files:
  • You need to login to have access to uploads.

I recommend using jQuery Input Mask for this scenario. Please refer to the attached example for more details.

Uploaded files:
  • You need to login to have access to uploads.

Thank you for your help.

I am trying to work out how that is connected to the example I sent but will have a go ;-)

I was hoping for an easy error trap solution to force the right entry and still wondering why the error causes the field to go blank and no error can be caught.

Anyway thank you again.

@jason-roberts please check the attached sample.

SetKeyboard "TextInput1" "decimal"
SetKeyboard "TextInput2" "decimal"
SetKeyboard "TextInput3" "decimal"
slAllowedChars "TextInput1" "0123456789,"
slAllowedChars "TextInput2" "0123456789,"
slAllowedChars "TextInput31" "0123456789,"

I have used TextInput as it is quite more versatile than NumericInput.
Also, do not use the input variable in place-holder. It has not sense.
Kind regards.

Uploaded files:
  • You need to login to have access to uploads.
asmat has reacted to this post.
asmat

Perfect!!

I had no idea you could limit text fields as numeric. Very useful and works on mobile too.

Thank you.