Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

onChange() event how does it work and what is the syntax

843838Nov 29 2005 — edited Nov 30 2005
hi,
i have a field (County) on a form in a jsp page that needs to get all its values from the database and present it to the user also i have another field (year) this also needs to get all its values as a drop down from the database.

i dont have any lib tag available to use and can't afford the time to set this up. so just have to script in jsp or use beans in jsp.
my question is 2fold
Q1. - i was thinking of having a DataAccess (dA) object to run a sql to select * distict couties ...
also have another query in DataAccess select * Distinct year....
and in the jsp instantiate the (dA) and iterate through and fill the select drop down box - how to code this syntax i'm not sure and if this is the correct approach or the only approach would appreciate some sample code that i can mess around with thanks.
- is above approach best way of doing this. - also taking into account Q2.
Q2 - when the user selects county then i need to fire a onChange event - probably using javascript but not sure how this works - bascially i need to then update the year drop down according to the below sql-
again how is this possible - and is this the best approach or will it be too many calls to the database - especially consdering that the forms are all part of a search tool.
SELECT	DISTINCT	v.year 
FROM		v_volumes	v
WHERE		v.county	= <the selected county>
OR		(v.county_reference	=
			(SELECT	ca.county_reference
			 FROM		county_aliases	ca
			 ,		counties	c
			 WHERE	ca.county_reference_also_called	= c.county_reference
			 AND		c.county	= <the selected county>)
		)
ORDER BY v.year
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2005
Added on Nov 29 2005
2 comments
273 views