[richfaces-issues] [JBoss JIRA] (RF-11833) Label for calendar results in non-valid markup

Lukáš Fryč (JIRA) jira-events at lists.jboss.org
Mon Mar 19 09:55:47 EDT 2012


    [ https://issues.jboss.org/browse/RF-11833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677644#comment-12677644 ] 

Lukáš Fryč edited comment on RF-11833 at 3/19/12 9:54 AM:
----------------------------------------------------------

There is no simple fix, since what JSF do for encoding {{for}} attribute is just taking client ID:

{code:title=JSF RI 2.1.5, LabelRenderer:85|Java}
String forClientId = null;
        String forValue = (String) component.getAttributes().get("for");
        if (forValue != null) {
            forValue = augmentIdReference(forValue, component);
            UIComponent forComponent = getForComponent(context, forValue, component);
            if (forComponent == null) {
                // it could that the component hasn't been created yet. So
                // construct the clientId for component.
                forClientId = getForComponentClientId(component, context,
                                                      forValue);
            } else {
                forClientId = forComponent.getClientId(context);
            }
        }
{code}

Problem is RichFaces does not decode inputs for components with complex DOM structure,
we use {{clientId}} for the root of the component's DOM and then input then needs to have ID/name with suffix.
                
      was (Author: lfryc):
    There is no simple fix, since what JSF do for encoding {{for}} attribute is just taking client ID:

{code:title=JSF RI 2.1.5, LabelRenderer:85|Java}
String forClientId = null;
        String forValue = (String) component.getAttributes().get("for");
        if (forValue != null) {
            forValue = augmentIdReference(forValue, component);
            UIComponent forComponent = getForComponent(context, forValue, component);
            if (forComponent == null) {
                // it could that the component hasn't been created yet. So
                // construct the clientId for component.
                forClientId = getForComponentClientId(component, context,
                                                      forValue);
            } else {
                forClientId = forComponent.getClientId(context);
            }
        }
{code}

Problem is RichFaces does not decode inputs for components with complex DOM structure,
we use {{clientId}} for the root of the component's DOM and then input needs to have ID/name with suffix.
                  
> Label for calendar results in non-valid markup
> ----------------------------------------------
>
>                 Key: RF-11833
>                 URL: https://issues.jboss.org/browse/RF-11833
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 4.1.0.Final
>            Reporter: Pavol Pitonak
>            Assignee: Lukáš Fryč
>            Priority: Trivial
>             Fix For: 4.2.1.CR1
>
>
> The code in first code snippet results in markup below which is not valid. The for attribute of the label element must refer to a form control, e.g. the actual input inside calendar (that with ID dateForm:fromDateInputDate).
> {code:xml}
> <h:outputLabel value="From date" for="fromDate" />
> <rich:calendar id="fromDate" .../>
> {code}
> {code:xml}
> <label for="dateForm:fromDate">From date</label>
> <span class="calendar" id="dateForm:fromDate">
>   <span id="dateForm:fromDatePopup" style="white-space: nowrap;">
>     <input class="rf-cal-inp " id="dateForm:fromDateInputDate" name="dateForm:fromDateInputDate" readonly="readonly" style="vertical-align: middle; " type="text" value="Nov 19, 2011" />
>   ...
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the richfaces-issues mailing list