Validate::minMaxNum let's me enter value below defined 'min'
Validate::minMaxNum let's me enter value below defined 'min'
This question has an accepted answers - jump to answer
This discussion has been closed.
This question has an accepted answers - jump to answer
Answers
Never mind ... I formatted the mysql column to 0.0000
I'm now using minMaxNum:
... but it still let's me enter a number below the defined 'min' e.g.
0.001 -> returns: 0.00
0.006 -> returns: 0.01
How can I show a Default error message: 'Please enter a number between 0.00 and 100' if a value below the defined min is entered instead (and not round it up)? It's working with the 'max' if I enter a value higher than defined 'max' ... but not vice versa with 'min'
Hi,
I'm slightly confused I'm afraid. Are you saying that if you enter
0.001
you want an error? But that is greater than the defined minimum of 0.Allan
Ähh ... now I'm confused too :-)
... I just don't want them to enter more digits (here 2) after the decimal separator.
So they can enter anything starting with
0.00
0.01
0.02
0.03
...
But if they want to enter 3 digits after the decimal separator like
0.001
0.013
0.026
...
they should get an error message that they can only enter 2 digits after the decimal seperator ...
Got it. So the issue is that 0.0000001 (or any other number of 0's) is in fact > 0, so the validator is in fact correct. What you need to to add extra validation. The built in validators don't have that ability though - you'd need to use a custom validator to check that the data is entered with a maximum of two decimal places.
Allan
Oh yes, I guess I got a little confused here :-) Yet, a custom validator raises too many ? on my sight right now, so I will stick to the current solution which is fine. Thanks a lot.