[seam-issues] [JBoss JIRA] Updated: (JBSEAM-4776) Add a prependId attribute on s:decorate

Anthony O. (JIRA) jira-events at lists.jboss.org
Mon Feb 7 10:56:39 EST 2011


     [ https://issues.jboss.org/browse/JBSEAM-4776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony O. updated JBSEAM-4776:
-------------------------------

              Summary: Add a prependId attribute on s:decorate  (was: Add a prependId property on s:decorate)
           Issue Type: Enhancement  (was: Bug)
    Affects Version/s: 2.2.0.GA
                           (was: 2.0.1.GA)
          Environment:     (was: JBoss Seam 2.0.1GA)
          Description: 
(Cloned from JBSEAM-2652 because it is a feature requirement)

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").


Is it possible to add a {{prependId}} attribute on {{s:decorate}} in order to control that ? Or perhaps {{s:decorate}} should takes care of its {{h:form}} {{prependId}} attribute value ?

  was:
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).




> Add a prependId attribute on s:decorate
> ---------------------------------------
>
>                 Key: JBSEAM-4776
>                 URL: https://issues.jboss.org/browse/JBSEAM-4776
>             Project: Seam
>          Issue Type: Enhancement
>          Components: JSF Controls
>    Affects Versions: 2.2.0.GA
>            Reporter: Anthony O.
>
> (Cloned from JBSEAM-2652 because it is a feature requirement)
> 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").
> Is it possible to add a {{prependId}} attribute on {{s:decorate}} in order to control that ? Or perhaps {{s:decorate}} should takes care of its {{h:form}} {{prependId}} attribute value ?

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

        


More information about the seam-issues mailing list