Hey,
I think you could do something like:

<html:form action="/returnToCallingScreen.do">
<logic:iterate id="myCollectionElement" name="options1" indexId="index">
        <tr>
        <td>
                <html:radio property="selected"
value="<%=index.toString()%>"/>
        <td>
        </tr>
</logic:iterate>
<html:submit/>
</html:form>

Then in your struts-config.xml you would specify a request scope bean that
would store the selected index from the form.  This bean is accessible in
your action class to use as you desire, and from there you can forward back
to the calling screen.
Does this help at all?

~ Keith
http://www.buffalo.edu/~kkamholz



-----Original Message-----
From: Tarun Sainanee [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 10:47 AM
To: Struts Users Mailing List
Subject: Help with a dynamic radio button


Hi,
I am generating multiple rows to show a search result on a jsp. Now i want 
to show the user a radio in every row. The user can select a any one radio 
and press a select button on the jsp to return to the calling screen.

The code as of now is 
                <logic:iterate id="myCollectionElement" name="options1" 
scope="request"> 
                         <tr>
                           <td>
                            <bean:write name="myCollectionElement" 
property="csLabel1"/>
                           </td>
                           <td>
                             <bean:write name="myCollectionElement" 
property="csLabel2"/>
                           </td>
                           <td>
                             <bean:write name="myCollectionElement" 
property="csLabel3"/>
                           </td>
                        </tr>
                </logic:iterate> 

I want to include a radio at  the beginning whose value i can alert on the 
screen. The value of the radio would be derived from one of the fields of 
the bean, the multiple instances of which populate the collection.

I have modified the code to look something like this:
                <logic:iterate id="myCollectionElement" name="options1" 
scope="request"> 
                        <tr>
                           <td>
                             <html:radio name="ResultSet" 
property="radioid" value="" onClick="radioValue()"/>
                           <td>
                           <td>
                             <bean:write name="myCollectionElement" 
property="csLabel1"/>
                           </td>
                           <td>
                             <bean:write name="myCollectionElement" 
property="csLabel2"/>
                           </td>
                           <td>
                             <bean:write name="myCollectionElement" 
property="csLabel3"/>
                           </td>
                        </tr>
                        </logic:iterate> 

The onclick event alerts the value of the radio 
(document.formname.radioid.value). But i always get an undefined as the 
alert. 
What am i doing wrong?

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to