Not sure what's in your form bean, but looks like you need
<html:checkbox name="lAnswers" property="answer" indexed="true" value="5"/>
But to do that, you'll have to change the id for your iteration to lAnswers
Cheers,
Dave
"Princeton Lau" <[EMAIL PROTECTED]> on 08/23/2001 12:40:34 PM
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
cc: (bcc: David Hay/Lex/Lexmark)
Subject: RE: html:radio tag indexed?
Dave,
That's great!
Meanwhile, I'm having other difficulties with the indexed tags...
I have the following JSP code. The generated form page looks good, however,
it doesn't link the check box property to the corresponding form attribute.
<%! int i=1; %>
<html:form action="/saveAnswers">
</p>
<table border="0" width="757">
<logic:iterate name="model" property="lQuestions" id="row"
type="org.wei.quiz.SurveyQuestion">
<tr>
<td width="18"><b><%=i%></b></td>
<td class="T3" width="583" colspan="5"><b><bean:write name="row"
property="question" /></b></td>
</tr>
<tr>
<td class="table_row_content_small" align="left" width="116">
<html:checkbox property="lAnswers" indexed="true"
value="5"/>5-Strongly Agree
</td>
<%i++;%>
</logic:iterate>
The above code generates the following HTML.
.
.
.
<td class="table_row_content_small" align="left" width="116">
<input type="checkbox"
name="org.apache.struts.taglib.html.BEAN[0].lAnswers" value="5">5-Strongly
Agree
</td>
.
.
.
Whereas I'd like it to generate...
.
.
.
<td class="table_row_content_small" align="left" width="116">
<input type="checkbox" name="lAnswers[0].answer"
value="5">5-Strongly Agree
</td>
.
.
.
Where lAnswers[0] is an element of an ArrayList, lAnswers, in my form.
Any ideas?
Thanks,
Princeton
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 4:17 PM
To: [EMAIL PROTECTED]
Subject: Re: html:radio tag indexed?
Hi. Have just replied to Nathan's post on the dev list.
I will make the changes to textAreas and radio buttons, and get them added
to
nightly build.
Cheers,
Dave
"Princeton Lau" <[EMAIL PROTECTED]> on 08/22/2001 04:01:37
PM
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
cc: (bcc: David Hay/Lex/Lexmark)
Subject: html:radio tag indexed?
Hello everyone and especially Dave Hays,
Has anyone tried updating the html:radio Struts tag to produce indexed
names? I am currently making a multiple choice survey application and
having an indexed radio button would be great!
Thanks,
Princeton
>From http://husted.com/about/struts/indexed-tags.htm
.
.
.
I have now finished updating several html Struts tags to produce indexed
names
such as
<input type="text" name="parameter[0].value" value="Mac">
when used within an iterate tag. These tags involve only minor changes to
the
existing tags, and to trigger them, "indexed=true" is added to the tag.
.
.
.