Forums Register Login

retreive selected value of list box

+Pie Number of slices to send: Send
hi all..
i have this list box in which many values like 1250,1355, 7777, and so on values r going to be there. When i select on any of the values in the list box the page should be refereshed and below i have a another form where i want to display details on the basis of the value that i have selected.!!
For example.. i have employee number 500 .. and below i have a form that displays details for that employee .. like i want to pass a sql statement saying
(select * from emptable where empnum = '"+empnum+"') and empnum has the value 500 ... now how do i pass the value 500 to the varaible empnum and how do i know which value have i selected in the list box and on selection how do i refresh the page..??
so i want to know these 2 things...
1. onselection in the list box refresh the page
2. then retreive the selected value in a variable..!
any suggestionss...plz?
+Pie Number of slices to send: Send
hia,
you can do something like this.
lets say u have a list box like this.
<SELECT size=2 id=select1 name=select1 onchange="call();" >
<OPTION value=1>1</OPTION>
<OPTION value=2>2</OPTION>
<OPTION value=3>3</OPTION>
and the function like this.
<SCRIPT LANGUAGE=javascript>
function call()
{
var x=document.frm1.select1.value ;
alert(x); //here 'x' gives the selected value
history.go(); //this refreshes the page
}
</SCRIPT>
hope this helps u.
Jyothsna
+Pie Number of slices to send: Send
but then in my jsp the values which are going to come are gonna be dynamic ... so i can't give static value in the option value... how do i go about the dynamic values for the list box...???
+Pie Number of slices to send: Send
Ok ... thanxs any way all..... my thing is done...!!!bye
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2941 times.
Similar Threads
html Checkbox value not getting
List Box problem
Struts 1.1: Help needed with html:select, html:options, html:optionsCollection
Html Select - to make an option selected
selecting an option in a select box from session variable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:22:47.