zwwcn

Just another WordPress.com site

Richfaces form validation and rich:messages

1  set attribute globalOnly=true for rich:messages (you will see the error message only in the global box but not in  the textfield box)

2 for each field:  add required=”true” and h:message

<div>
<label for=”faceValue”>Face Value:</label>
<h:inputText id=”faceValue” required =”true” value=”#{voucherController.faceValue}”/>
<h:message for=”faceValue” errorClass=”invalid” warnClass=”invalid” required =”true” infoClass=”invalid”></h:message>
</div>

3 add server side validation, this error msg will only display in global box

facesMessages.add(“Face value should be equal or greater than buy value”);

results:

form validation error will only display in form fields, server side business check error will only display in global box

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: