tr:selectBooleanCheckbox error message not displayed
----------------------------------------------------

                 Key: TRINIDAD-1864
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1864
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 2.0.0-alpha-2
         Environment: windows 7 64-bit, firefox 3.6
            Reporter: Karel Simek


I am working on ARIA implementation for various input elements. I am however 
unable to display selectBooleanCheckbox's error message. The message gets added 
to the <tr:messages> but not directly to the selectBooleanCheckbox itself. I 
have tried various settings and combination of properties without any success.

Here is the code, value listener and simple custom  validator:

-- jspx file
 
<tr:selectBooleanCheckbox label="Label:"
                      textAndAccessKey=" checkbox&amp;1"
                      simple="false"
                      required="true"
                      valueChangeListener="#{identity.checkboxCheck}"
                      autoSubmit="true"
                      accessKey="1"/>

               <tr:selectBooleanCheckbox label="Label:"
                      text="text is here"
                      requiredMessageDetail="is required"
                      showRequired="true"
                      simple="false"
                      validator="#{identity.validateCheckbox}"
                      required="true"
                      accessKey="1"/>

-- bean

public void checkboxCheck(ValueChangeEvent event) {
    boolean vysl = (Boolean)event.getNewValue();
    if (vysl== false) {
      FacesContext context = FacesContext.getCurrentInstance();
      FacesMessage message = new FacesMessage(
         "cannot be false!");
      context.addMessage(event.getComponent().getClientId(context), message);
    }
}


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(UIInput.REQUIRED_MESSAGE_ID, clientId);
         throw new ValidatorException(message);
     }
}   

What is the correct way to display the associated error message?

Thanks for help!   

Karel


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to