Requirements:
- enforce 2 digits after the decimal point - auto insert (.)00 if a regular integer entered e.g a 1 becomes 1.00
- The products should always have a height and width > 0 so 0.01 is the smallest value the user should be able to input
- maximum of 6digits before the decimal point
- If a user enters .1 it should transform value to 0.10
- If a user enters .12 it should transform value to 0.12
********EDIT*************
USE DECIMAL FIELD TO AUTO INSERT THE DECIMAL POINT & TRAILLING DIGITS
*******************************
These values are allowed/disallowed:
Allowed | Disallowed |
0.01 | 0.00 |
123456.99 | 012345.00 |
12.00 | 12.0 |
119.75 | 119.759 |
99.00 | 99 |
Here's what I settled on for my custom regex:
^(0(\.(0[1-9]|[1-9]\d))?|([1-9]\d{0,5}\.\d{2}))$
handler:
price6pt2
field type:
string
Length (property):
9 (to include decimal point '.')
Thanks @g1smd for all the help!
Gez