Reputation: 3
I want to apply validation if -ve value is entered. I could do that using below tags and attributes:
<h:inputText id="MyPrice" validatorMessage="negatieve prijs niet toegestaan">
<f:convertNumber type="number"
groupingUsed="true"
locale="nl_NL"
maxFractionDigits="2"
minFractionDigits="2"/>
<f:validateLongRange minimum="0"/>
<h:inputText>
<rich:message for="MyPrice"/>
Using this I can successfully validate -ve and +ve values with below inputs:
Went right for: [I'm following Netherlands number system where ',' is treated as '.' eg to write 0.55 we need to write 0,55) that is done by me using <f:convertNumber>
.
100
10.25
10,98
-100
-10.25
-10,98
0.55
But when I entered -0,55, validation didn't work. Kindly provide solution to validate when I'm entering -ve value that starts with -0.xx.
Upvotes: 0
Views: 1029
Reputation: 3728
Your validator is not correct - price is not Long
. Change it to
<f:validateDoubleRange minimum="0" />
Upvotes: 1