[ http://issues.apache.org/jira/browse/MYFACES-716?page=comments#action_12332575 ]
Vinnie Fazio commented on MYFACES-716: -------------------------------------- Thank you Sharath! I do not know what to think of this. You're example looks exactly like mine. Are you using the MyFaces implementation of JSF? I am using Tomahawk with Sun's JSF RI. Maybe that is the problem. I wrote my own component to display the list, but I had to surround the body with h:column tags to generate the correct ids. I think this is because my component extends UIData. Thank you for your response, Vinnie > Problem using JSF input components with DataList > ------------------------------------------------ > > Key: MYFACES-716 > URL: http://issues.apache.org/jira/browse/MYFACES-716 > Project: MyFaces > Type: Bug > Versions: Nightly > Reporter: Vinnie Fazio > > I was using the Tomahawk 20050912 nightly build when I first noticed this > bug. I have since upgraded to the nightly build from 20051017 and am > experiencing the same issue. > THE PROBLEM: > ============= > Here is the JSF I am using: > <f:subview id="results"> > <h:form> > <x:dataList value="#{myList}" var="current" layout="orderedList" > > <h:selectBooleanCheckbox value="#{current.selected}"/> > <h:commandLink action="#{current.display}"> > <h:outputText value="#{current.name}"/> > </h:commandLink> > </x:dataList> > </h:form> > </f:subview> > ADDITIONAL INFO > =============== > The html seems to be look OK, but when I select an item (either the link or > the checkbox) and the form is submitted, the value referenced is always the > first value from the list. A closer look at the HTML source shows that all > the ids (names) generated are the same... > <li><input type="checkbox" name="results:_id27:_id43:_id44" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:_id45'; > document.forms['results:_id27'].submit(); return false;">Value1</a></li> > <li><input type="checkbox" name="results:_id27:_id43:_id44" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:_id45'; > document.forms['results:_id27'].submit(); return false;">Value2</a></li> > <li><input type="checkbox" name="results:_id27:_id43:_id44" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:_id45'; > document.forms['results:_id27'].submit(); return false;">Value3</a></li> > If I change the datalist to a h:datatable I get html with unique ids and all > the links work correctly. For instance... > <tr> > <td><input type="checkbox" name="results:_id27:_id43:0:_id45" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:0:_id46'; > document.forms['results:_id27'].submit(); return false;">Value1</a></td> > </tr> > <tr> > <td><input type="checkbox" name="results:_id27:_id43:1:_id45" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:1:_id46'; > document.forms['results:_id27'].submit(); return false;">Value2</a></td> > </tr> > <tr> > <td><input type="checkbox" name="results:_id27:_id43:2:_id45" /><a href="#" > onclick="document.forms['results:_id27']['results:_id27:_idcl'].value='results:_id27:_id43:2:_id46'; > document.forms['results:_id27'].submit(); return false;">Value3</a></td> > </tr> > I HAVE TRIED > ============ > - I have tried setting the forceIDIndex field to true and it did not change > anything. > - I noticed in similar bug that the user posted a workaround of surrounding > the input components with <h:column>, but that did not work either. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
