Hi, I've got a simple question regarding to validating <tr:table> component. I
just want to make sure that at least one of the rows in the table are being
selected before proceeding to the next page, after pressing the submit button.
I have validation code like this:
private CoreTable product;
public void validateToCart(FacesContext context, UIComponent toValidate,
Object value) throws ValidatorException {
Iterator selection = product.getSelectedRowKeys().iterator();
if (!selection.hasNext()) {
FacesMessage message = new FacesMessage("No items selected!");
throw new ValidatorException(message);
}
}
How do I call this method from the page? I found that there is no validator
attribute in the <tr:table> component nor in the <tr:commandButton> component.
Thanks.
Best Regards,
Henry Chang