| Author |
JSP beginner - adding listbox
|
Noreen Masterson
Greenhorn
Joined: Apr 30, 2002
Posts: 16
|
|
Hi I am just starting to use JSPs and have been trying to add a listbox to one how do i go about this - it should just be a single selection listbox.... All help appreciated thanx muchly Noreen
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
Start by making a plain HTML page with a listbox, any good HTML text will tell you how. After you get what you want with plain HTML then you can try to duplicate it with JSP. Bill
|
 |
Noreen Masterson
Greenhorn
Joined: Apr 30, 2002
Posts: 16
|
|
Hi have my listbox using SELECT and added in my list using OPTION i have a button on the jsp too and would like to have a onclick method that will pick up the selected item in teh listbox ..... i know how to do the onckcik function in javascript but how do i access the list from it? cheers
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
window.document.formName.selectName.value will give the value of the selected item from the listbox. Replace formName with the name of your form and selectName with the name of the listbox. [ November 29, 2002: Message edited by: R Manivannan ]
|
Mani
Quaerendo Invenietis
|
 |
Nilesh Dudhekar
Greenhorn
Joined: May 25, 2002
Posts: 1
|
|
hi noreen, make the plain html with all the controls required ...i ur case a listbox and a button. u can write a js function which will display the selected value of the listbox....this will be onclick of a button follwing function will give u requird value fnchk() { for(var i=0;i<window.document.form.selectList.length;i++) { if(window.document.form.selectList.options[i].selected==true) { // this will be the value in list box which u will required. } } } hope this will help u...
|
 |
 |
|
|
subject: JSP beginner - adding listbox
|
|
|