regular expression or mask sample?

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
antonio
Posts: 77
Joined: 2010-09-28 11:48

regular expression or mask sample?

Post by antonio » 2011-12-13 11:54

Hi all,
I just can't make my validation form behaviour to behave correctly.

I need to validate a numeric input field so that the user enter:

VALID VALUES:
1,1
10,01
1000,01
1,0001

NOT VALID VALUES:
1as
1.01
1.000,01

But I cannot find a way to create a mask or regular expression to do this.
Basically the user shuld be forced to enter a number with or without decimals.
The ADDT validation check for integers, positive integers and not as above.
I've set the field as numeric and set validation to 'required' (no validation rule) and number greater than 0.
This way the user can successfully enter:
1
1,0
0,1
and, strangely enough, these values are valid too:
1a
jfj2
8fjjfjf

???

How can I be sure the user entered a number (with or without decimals)?

TIA ver much. ;)

tony

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: regular expression or mask sample?

Post by Fred » 2011-12-16 18:24

Take a look at these examples from Stackoverflow

http://stackoverflow.com/questions/3081 ... ision-of-2

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: regular expression or mask sample?

Post by antonio » 2011-12-19 10:06

thnaks Fred,
I've googled a lot but didn't find a sample that would accomodate my request. Your link is good. Thanks again.

tony

Post Reply