Not really related to JSP, seems to me that you have to study some more
client-side techniques.
Either you put all possible values that the second box can have as a
JavaScript array and use JS to populate the box depending on the selected
value of the first box, this doesn't require a reload of the page.
Otherwise, if you have many elements in the database you probably don't want
to send all of them to the page, simply open the same page with different
parameters and then fill the boxes accordingly.
Both cases uses the onChange attribute in the SELECT
<SELECT NAME="state" ONCHANGE="fillMe(this)">
..
</SELECT>
The fillMe function would use the box to find the attribute and perhaps look
something like this, if you choose to reload the page, querying the db
again.
function fillMe(box)
{
var selVal = box.options[box.selectedIndex].value;
// Might be some other JS method that opens an url in this window
document.open('thisPage.jsp?' + box.name + '=' + selVal, '_self');
}
The page simply populates the second SELECT depending on the parameter, in
this case 'state', if state isn't submitted you use the defaultValue to
state.
/Marcus
-----Original Message-----
From: Masaoud [mailto:[EMAIL PROTECTED]]
Sent: den 26 november 1999 10:16
To: [EMAIL PROTECTED]
Subject: Events in JSP
Hi,
I have the following problem.
I have a JSP Page, on which are two List Boxes. There is also a bean on
this JSP page which has setter and getter functions for the fields on
the form, & gives access to the database on the server via JDBC. When
the user selects some element from the first List Box, the second List
Box is to be populated from a some table in a database at the server.
I have the following doubts :
1. How can I detect the "Event", that the user has selected an item from
the first list box ?
2. In short how would I do the bove mentioned ?
Thanx
Masaoud
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html