f:validateDoubleRange |
|
The ValidateDoubleRange tag registers a DoubleRangeValidator instance on the component associated with the enclosing tag. This tag can be used to validate user input when the expected input is a floating-point value.
Example:
<h:inputText id="withdraw" value="#{accountBean.withdraw.amount}">
<f:validateDoubleRange minimum="20.00" maximum="1000.00" />
</h:inputText>
<h:message for="withdraw" />
HTML Output
<input id="form:withdraw" name="form:withdraw" type="text" value="5"/>
"withdraw": Specified attribute is not between the expected values of 20 and 1000.
When the form is submitted with the value 5 in the input field, the JSF framework will convert and validate the user input to determine if the value is between the minimum and maximum values defined by the validateDoubleRange tag. Since the input is not valid, the JSF framework creates a validation message that can be displayed using the h:message or h:messages tags.
|