This content has been marked as final.
Show 4 replies
-
1. Re: Allow only dollar amounts in text field
cash1981 Oct 19, 2009 7:58 PM (in response to oneworld95)Easy. Create a validator that performs a regex expression that meets your criteria.
Read on the seam documentation how to create a validator<h:inputText value="Amount" action="#{myBean.amount}" validator="#{validator.checkAmount}" required="true"/>
-
2. Re: Allow only dollar amounts in text field
oneworld95 Oct 19, 2009 8:03 PM (in response to oneworld95)Thanks, Shervin. I tried going the easy way -- using the @Pattern for a string and it didn't work. It would only fire when the field's required property was set to true. It seems to be a bug or something: @Pattern Example
The only thing is that this field isn't required.
-
3. Re: Allow only dollar amounts in text field
cash1981 Oct 19, 2009 8:24 PM (in response to oneworld95)That seems strange. If it is an entity bean that @Pattern should have worked without the need to have required set to true.
Anyway, it should work by using custom validator.
-
4. Re: Allow only dollar amounts in text field
blabno Oct 19, 2009 10:29 PM (in response to oneworld95)It is JSF 1.2 decision (will be removed in 2.0) that empty field is not validated.