Forums Register Login

Drop down Menu, Option,value

+Pie Number of slices to send: Send
Folks,
Is there a way I can get the Option that has been selected in the page. I know that we can get optionValue by request.getParameter("dropDown"); I want to able to capture the option also i.e if the user selects <option value="1">first</optiont>, can I get Option name "first" that the user has selected?

<select name="dropDown">
<option value="1">first</optiont>
<option value="2">second</optiont>
</select>
+Pie Number of slices to send: Send
If you are using a bean to populate the dropdown, you can get the string back again using the value which has been sent.
The string inside the option tag is not send in the request, so I think you'll have to use a bean or an array or whatever you want to contain the dropdown information.
+Pie Number of slices to send: Send
Thanks a lot for your response. Will give a shot at it.
+Pie Number of slices to send: Send
 

Originally posted by Satou kurinosuke:
The string inside the option tag is not send in the request, so I think you'll have to use a bean or an array or whatever you want to contain the dropdown information.



I think using a Map is a better idea.
+Pie Number of slices to send: Send
I konw you till now did not get the appropriate answer.
See you have two options;
1. Create a mapping file which hold the drop down value as a key and option name as a map value.
2. Change the name of the option value itsefl to something relevvant which you can use.

There are no methods as such to do it.
+Pie Number of slices to send: Send
 

Originally posted by ranjan panda:
I konw you till now did not get the appropriate answer.



Excuse me? How have the answers to date not been appropriate?


1. Create a mapping file which hold the drop down value as a key and option name as a map value.



Why would a file be used?


2. Change the name of the option value itsefl to something relevvant which you can use.



May not be appropriate if the values are dictated by the back end and it's rather silly to constrain the values in such a way needlessly.
[ May 22, 2006: Message edited by: Bear Bibeault ]
What are you doing? You are supposed to be reading this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1211 times.
Similar Threads
correct Ajax script syntax for second DropDown
How to get total count of selected Items of <Select>
dymamic generate text input field
how to show a dropdown box without the preselected value shown up
html:options horrible default settings
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:23:25.