[
https://issues.apache.org/jira/browse/TOMAHAWK-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13550890#comment-13550890
]
Venom KH commented on TOMAHAWK-1188:
------------------------------------
I am using the selectManyCheckbox with version Tomahawk 1.1.14, but those
checkboxs generated by the Tomahawk have duplicated id.
<t:selectManyCheckbox value="#{bean}" layout="pageDirection" layoutWidth="3"
style="width:100%" forceId="true" forceIdIndex="true">
<f:selectItems value="#{bean.item}"></f:selectItems>
</t:selectManyCheckbox>
Following is the generated HTML, the id is duplicated.
<table style="width:100%"><tr><td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="7" /> C</label>
</td>
<td><label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="20" />B </label></td>
<td><label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="9" />C</label></td>
</tr>
<tr><td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="123" />D</label></td>
<td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="6" />E</label></td>
<td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="4" />F</label></td></tr>
<tr><td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="8" />G</label></td>
<td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="18" />H</label></td>
<td>
<label><input id="j_id1233214322_1_1d8292d7:0" type="checkbox"
name="j_id1233214322_1_1d8292d7" value="1" />I</label></td></tr></table>
It seems the source code of
org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer
Line 279: renderCheckbox(facesContext, selectMany, itemStrValue,
disabled, checked, false,0);
The last parameter itemNum is always Zero. It should be a number depending on
the current Index of the checkbox,right?
> many HtmlCheckbox rendered with the same id with HtmlSelectManyChecbox spread
> layout
> ------------------------------------------------------------------------------------
>
> Key: TOMAHAWK-1188
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-1188
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Affects Versions: 1.1.6
> Environment: Tomahawk + JSF-RI 1.2.06 + Facelets
> Reporter: Marcin Kobylarz
> Assignee: Leonardo Uribe
> Fix For: 1.1.7
>
>
> This piece of code:
> <t:selectManyCheckbox id="xxx" layout="spread"
> value="#{checkboxTest.selectedItems}">
> <t:selectItems value="#{checkboxTest.items}" var="item"
> itemValue="#{item}" itemLabel="#{item}" />
> </t:selectManyCheckbox>
> <t:checkbox id="item1" for="xxx" index="0"></t:checkbox>
> <t:checkbox id="item2" for="xxx" index="1"></t:checkbox>
> causes all the checkboxes to be rendered to html with the same id. This
> violates html object id uniqueness.
> Solution:
> ---
> tomahawk_1.1.6/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java
> 2007-03-23 10:05:42.000000000 +0100
> +++
> tomahawk_patched/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java
> 2008-01-31 16:21:28.000000000 +0100
> @@ -406,7 +406,7 @@
> itemStrValue,
> selectItem.getLabel(),
> isDisabled(facesContext,uiSelectMany),
> - lookupSet.contains(itemStrValue), true);
> + lookupSet.contains(itemStrValue), false);
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira