Problem in iterating over List and Radio button

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem in iterating over List and Radio button

                                                                                                                                            </s:iterator>

  How to pass Question and User values of a particular selection to a javascript function?

i.e.,
<script type="text/javascript"> function Show(que,user) { alert(que); alert(user); } </script>
<s:radio onclick="Show('%{Question}','%{User}')"/>


Thanks in advance,
NR031
Hi,

   I am having a list questionListCoDriver/ in my action class which sets different values for Question, Date and User. I want to iterate over the list, meanwhile I need to place a radio button for every entry. Following is my code :


<s:iterator value="questionListCoDriver">
                               
                                       
                                        <s:property value="Question" />
                                   
                                        <s:property value="Date" />
                                   
                                        <s:property value="User" />
                                   
Reply | Threaded
Open this post in threaded view
|

Re: Problem in iterating over List and Radio button

Dhanakumar
Hi,

actually for dropdowns,radio input list or checkbox list, the collection in Action is as follows.

List<LabelValue> skills;

where LabelValue has Long value; and String label; variables, and value is used to hold the radio input id, or check box id, and label is used to display beside the radio or checkbox.

so, the following code works well for you.

<s:radio id="myid" listKey="value" listValue="label" list="skills" onclick="alert(this.id)"/>