myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karel Simek (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (TRINIDAD-1864) tr:selectBooleanCheckbox error message not displayed
Date Sat, 24 Jul 2010 10:19:50 GMT

    [ https://issues.apache.org/jira/browse/TRINIDAD-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12891967#action_12891967
] 

Karel Simek commented on TRINIDAD-1864:
---------------------------------------

UPDATE: This issue should probably be merged with https://issues.apache.org/jira/browse/TRINIDAD-1791

> 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
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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.


Mime
View raw message