Add a prependId property on s:decorate
--------------------------------------

                 Key: JBSEAM-4776
                 URL: https://issues.jboss.org/browse/JBSEAM-4776
             Project: Seam
          Issue Type: Bug
          Components: JSF Controls
    Affects Versions: 2.0.1.GA
         Environment: JBoss Seam 2.0.1GA
            Reporter: Anthony O.


Given the following code:
<h:form id="login" prependId="false">
        <s:validateAll>
            <f:facet name="afterInvalidField">            
                <s:label styleClass="error">
                        <s:message/>
                </s:label>
            </f:facet>
            <div class="labelinputcombo ilcblock">  
                <h:outputLabel for="username">User name:</h:outputLabel>        
                
                <s:decorate>
                        <h:inputText id="username" 
value="#{registrationService.newUser.userName}" required="true"/>               
                                             
                </s:decorate>
            </div>
         </s:validateAll> 
         <div>
            <h:commandButton value="Register" 
action="#{registrationService.registerUser}"/>
         </div>
</h:form>

One would expect that none of the generated <input> elements would have 
prepended IDs, since the h:form has prependId="false". However, since 
s:decorate insists on inserting a superfluous <div> with a generated ID around 
the <input> elements it surrounds, those <input> elements end up having 
prepended IDs from that <div>. The relevant generated HTML:

<div class="labelinputcombo ilcblock">
  <label for="j_id31:username">User name:</label><div id="j_id31"><input 
id="j_id31:username" type="text" name="j_id31:username" /></div>
</div>

I did not ask for either the <div> or it's ID (<div id="j_id31">), or its 
insertion into my <input> element's ID (id="j_id31:username").

Proposed solutions:
1. Remove the generated <div>. Is it really necessary for the functionality of 
s:decorate? If I want a div I can always add it myself.
2. If the <div> really is necessary, at least make s:decorate respect the 
prependId="false" attribute of the surrounding h:form.
3. If that is not possible, as a last resort, introduce a prependId attribute 
on the <s:decorate> tag so we can at least force this behaviour if we want it.

On a more general note, 
I'm a really big fan of the JSF-Seam-EJB3 combo, but some of the design 
decisions in the frameworks are baffling. Why so many superfluous generated 
html tags? And who thought of the bright idea of prepending element id 
attributes using : (colon) as the delimeter?? This effectively cripples the 
ability to use CSS to style JSF-generated HTML elements with a simple CSS id 
selector (since : is a reserved symbol in CSS).


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues

Reply via email to