prain
asked on
Capturing Information from multiple List Boxes in the doPost() - How
Ok. Here is the scenario
I have two list boxes. One attach to a submit button and the other attached to another submit button.
All of these are in the same form.
Here is a skeleton of my code.....
<form method= "post" action="/pSystem/PServlet" >
<table>
<tr>
<td>
<select name='List1'>;
<option>item1</option> ");
<option>item2</option> ");
<option>item3</option> ");
</select>
</td>
<td>
<input type="submit\" name=\"from_List1" value="Select from List 1>
</td>
</tr>
<tr>
<td>
<select name='List2'>;
<option>item4</option> ");
<option>item5</option> ");
<option>item6</option> ");
</select>
</td>
<td>
<input type="submit\" name=\"from_List2" value="Select from List 2>
</td>
</tr>
</table>
</form>
Ok. as you see all are in the same form. So when I click, from_list1, it goes
to the doPost() of PSevlet and also when I click the from_list2, it goes to
the doPost of PSevlet.
What I need to do is when from_list1 is clicked, I want to capture the selected items
in List1 in the doPost() and when I click the from_list2, I want to capture the
selected items in List2.
Any ideas are appreciated.
I have two list boxes. One attach to a submit button and the other attached to another submit button.
All of these are in the same form.
Here is a skeleton of my code.....
<form method= "post" action="/pSystem/PServlet"
<table>
<tr>
<td>
<select name='List1'>;
<option>item1</option> ");
<option>item2</option> ");
<option>item3</option> ");
</select>
</td>
<td>
<input type="submit\" name=\"from_List1" value="Select from List 1>
</td>
</tr>
<tr>
<td>
<select name='List2'>;
<option>item4</option> ");
<option>item5</option> ");
<option>item6</option> ");
</select>
</td>
<td>
<input type="submit\" name=\"from_List2" value="Select from List 2>
</td>
</tr>
</table>
</form>
Ok. as you see all are in the same form. So when I click, from_list1, it goes
to the doPost() of PSevlet and also when I click the from_list2, it goes to
the doPost of PSevlet.
What I need to do is when from_list1 is clicked, I want to capture the selected items
in List1 in the doPost() and when I click the from_list2, I want to capture the
selected items in List2.
Any ideas are appreciated.
ASKER
fargo....
please bear with me...
in your comment, you say "submit the form with javascript"
How to do that?
I am sorry. Not an expert :-)
prain
please bear with me...
in your comment, you say "submit the form with javascript"
How to do that?
I am sorry. Not an expert :-)
prain
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
fargo,
Ok I got the idea now. Let me get back with you soon with the result.
prain
Ok I got the idea now. Let me get back with you soon with the result.
prain
ASKER
Fargo,
That's pretty good. All works well.
Thanks very much.
prain
That's pretty good. All works well.
Thanks very much.
prain
in servlet
if(request.getParameter("h
listValue= request.getParameter("List
}else if(request.getParameter("h
listValue= request.getParameter("List
}