• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

retreive selected value of list box

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mehak Darti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...???
 
Mehak Darti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok ... thanxs any way all..... my thing is done...!!!bye
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic