[ https://issues.apache.org/jira/browse/TOMAHAWK-1429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719627#action_12719627 ]
Mathias Werlitz commented on TOMAHAWK-1429: ------------------------------------------- org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer.renderSingleCheckbox() should looke like: protected void renderSingleCheckbox(FacesContext facesContext, HtmlCheckbox checkbox) throws IOException { String forAttr = checkbox.getFor(); if (forAttr == null) { throw new IllegalStateException("mandatory attribute 'for'"); } int index = checkbox.getIndex(); if (index < 0) { throw new IllegalStateException("positive index must be given"); } UIComponent uiComponent = checkbox.findComponent(forAttr); if (uiComponent == null) { throw new IllegalStateException("Could not find component '" + forAttr + "' (calling findComponent on component '" + checkbox.getClientId(facesContext) + "')"); } if (!(uiComponent instanceof UISelectMany)) { throw new IllegalStateException("UISelectMany expected"); } UISelectMany uiSelectMany = (UISelectMany)uiComponent; Converter converter = getConverter(facesContext, uiSelectMany); List selectItemList = RendererUtils.getSelectItemList(uiSelectMany); if (index >= selectItemList.size()) { throw new IndexOutOfBoundsException("index " + index + " >= " + selectItemList.size()); } SelectItem selectItem = (SelectItem)selectItemList.get(index); Object itemValue = selectItem.getValue(); String itemStrValue = getItemStringValue(facesContext, uiSelectMany, converter, itemValue); Set lookupSet = RendererUtils.getSubmittedValuesAsSet(facesContext, uiSelectMany, converter, uiSelectMany); boolean useSubmittedValues = lookupSet != null; if (!useSubmittedValues) { lookupSet = RendererUtils.getSelectedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany); } boolean checked = (useSubmittedValues && lookupSet.contains(itemStrValue)) || (!useSubmittedValues && lookupSet.contains(itemStrValue)); ResponseWriter writer = facesContext.getResponseWriter(); //renderCheckbox(facesContext, // uiSelectMany, // itemStrValue, // selectItem.getLabel(), // isDisabled(facesContext,uiSelectMany), // lookupSet.contains(itemStrValue), true); String itemId = renderCheckbox(facesContext, uiSelectMany, itemStrValue, isDisabled(facesContext,uiSelectMany), checked, false, index); //Render the // label element after the input boolean componentDisabled = isDisabled(facesContext, uiSelectMany); boolean itemDisabled = selectItem.isDisabled(); boolean disabled = (componentDisabled || itemDisabled); HtmlRendererUtils.renderLabel(writer, uiSelectMany, itemId, selectItem.getLabel(), disabled); } > t:checkbox not checked correctly after validation error > ------------------------------------------------------- > > Key: TOMAHAWK-1429 > URL: https://issues.apache.org/jira/browse/TOMAHAWK-1429 > Project: MyFaces Tomahawk > Issue Type: Bug > Affects Versions: 1.1.8 > Environment: Sun RI, JSF 1.2 > Reporter: Mathias Werlitz > > If you use t:selectManyCheckbox with layout="spread" and t:checkbox the > selection of the checkboxes after an validation error is incorrect. When > using layout="pageDirection" it is correct. > When using layout="spread" and t:checkbox HtmlCheckboxRenderer renders the > last successfully validated component values (intenally stored > HtmlSelectManyCheckbox.value) checked after an validation error. This is not > correct. It should render the checkboxes as submitted like > HtmlCheckboxRenderer does when t:selectManyCheckbox is used with > layout="pageDirection". > The method renderSingleCheckbox() of > org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer should lookup the > valueSet like in renderCheckboxListVertically() and determine the checked > boolean more like renderGroupOrItemCheckbox(). > Example: > <t:selectManyCheckbox id="test" required="true" value="#{value}" > layout="spread" > > <t:selectItems ...../> > </t:selectManyCheckbox> > <t:checkbox for="test" index="0" /> > <t:checkbox for="test" index="1" /> > <t:checkbox for="test" index="2" /> > <h:inputText required="true" /> > 1. you select checkbox one and submit the form -> validation error for > inputText > 2. you deselect checkbox one and submit the form -> validation error for > selectManyCheckbox and inputText BUT > checkbox one is checked although it was submited not checked -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.