Skip to main content
Solved

Attribute Input Mask: Numbers with Two Decimal Places

  • 19 August 2024
  • 1 reply
  • 116 views

Forum|alt.badge.img

Hello! I am trying to use an input mask to allow for numerical entry only where the number has two decimal places.

 

For instance, we manufacture parts that have dimensions such as 68.50” and 82.25”. I tried using the input masks ##.##” and 90.99” on the attribute itself but when I enter the values above I get the following results:

68.50” → 68._5”

82.25” → 82._2”.

 

I had figured out that we could use something such as 90.99#” but it then returns values as:

 

82.25” → 82._25”

 

This isn’t ideal and could get confusing. Is there anyway to force a number right after the decimal?

Also, I believe I found a bug in the system when it comes to these input masks. Using the 90.99#” input mask above, it registers the number but every time I click on the attribute and click off it reduces the number and adds a space.

 

Thank you!

Best answer by darylbowman

This regex (REGular EXpression) may suit your situation more:

/^(0|[1-9]\d*)(\.\d+)?$/

View original
Did this topic help you find an answer to your question?

1 reply

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1588 replies
  • Answer
  • September 16, 2024

This regex (REGular EXpression) may suit your situation more:

/^(0|[1-9]\d*)(\.\d+)?$/


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings