zwwcn

Just another WordPress.com site

Monthly Archives: January 2012

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

maximize window for selenium webdriver

Toolkit toolkit = Toolkit.getDefaultToolkit();

Dimension screenResolution = new Dimension((int) toolkit.getScreenSize().getWidth(), (int) toolkit.getScreenSize().getHeight());

driver.manage().window().setSize(screenResolution);