Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation inside tr:table

 
prasad kolla
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to display a list of check boxes which are displayed inside a tr:table, I am doing a server validation to check if the checbox is checked or not. If not selected i am throwing a validation message asking the user to select the check box.

In this process alignment of the check boxes is lost, it puts a empty space ahead of check box.

code looks like this:


<tr:table var="result" styleClass="indent" width="100%"
value="#{mybean.listOfConfirmationChecks}">
<tr:column width="95%" separateRows="true">
<tr:selectBooleanCheckbox id="confirmationCheckBox"
disabled="#{result.isDisabled}" validator="#mybean.validateCheckbox}"
autoSubmit="true" value="#{result.isChecked}" required="#{result.isMandatory}" />
</tr:column>
</tr:table>



inside the bean i have a validator method:

public void validateCheckbox(FacesContext context, UIComponent component, Object value) {
if (value instanceof Boolean && ((Boolean) value).equals(Boolean.FALSE)) {
String clientId = component.getClientId(context);
FacesMessage message = MessageFactory.getMessage(context,UIInput.REQUIRED_MESSAGE_ID);
throw new ValidatorException(message);
}


does any one have any idea how to make an alignment or

How to call a validator method on page submition to validate the attributes of the list??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic