Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ComboBox

7 views
Skip to first unread message

LMario

unread,
Jan 29, 2008, 4:31:47 PM1/29/08
to

On a WEB Page, how can I detect with JSP when I select one item on a ComboBox?

Kevin Dean [TeamB]

unread,
Jan 29, 2008, 9:07:52 PM1/29/08
to
LMario wrote:

>On a WEB Page, how can I detect with JSP when I select one item on a
>ComboBox?

You can use JavaScript to intercept the onchange event of the combo box
and post the change to the server. The server can then respond by
updating whatever is affected by that combo box. Alternately, you can do
it all in JavaScript.

--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

Please see CodeGear's newsgroup guidelines at
http://support.codegear.com/newsgroups/guidelines

Paul Nichols [TeamB]

unread,
Apr 2, 2008, 2:12:24 AM4/2/08
to
As per Kevin's response. Here is an example:
<html>
<head>
<html>
<head>
//Returns the name of the browser
<script language="JavaScript">
function getBrowser(){
var browser=navigator.appName;
return browser;
}

//Here's the getComboxBoxValue that returns the Combo Box's Value
function getComboBoxValue(id){
var cbox=document.getElementById(id);
alert(cbox.options[cbox.selectedIndex].text);

}
</script>

<body>

<select id="combo" onchange="getComboBoxValue('combo')">
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
<br/>
<br/>
<select id="combo2" onchange="getComboBoxValue('combo2')">
<option> Uno</option>
<option>Dos</option>
<option>Tres</option>
</select>

<body>
</html>

"LMario" <lmms...@hotmail.com> wrote in message
news:479fa953$1...@newsgroups.borland.com...

0 new messages