Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populate related select box.

Status
Not open for further replies.

joelxez

Programmer
Apr 18, 2002
67
PH
hi experts,

I have a sample on how to populate related two select box by populating the next select box based on my selected value.
but what i want to know is to put an action so that the value will pass to another page after clicking submit button, i heard this can be done in javascript.

Any one who can help me to do this in a javascript function not in submit() function?



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>
<cfif isDefined("form.department")>
<cfset setdepartment=form.department>
</cfif>

<form method="post">
Dapartment:
<select name="department" onchange="this.form.submit()">
<option value="1" <cfif Isdefined("setdepartment")><cfif form.setdepartment EQ 1>Selected</cfif></cfif>>Department 1</option
<option value="2" <cfif Isdefined("setdepartment")><cfif form.setdepartment EQ 2>Selected</cfif></cfif>>Department 2</option
</select>

<cfif Isdefined("setdepartment")>
Category:
<cfquery name="GetCategory" datasource="DSN">
SELECT * FROM tbcategory WHERE department=#setdepartment#
</cfquery>

<select name="categories">
<cfoutput>
<cfloop query="GetCategory">
<option value="cID">#category#</option>
</cfloop>
</cfoutput>
</select>

</cfif>


<input type="submit" name="submit" value="submit">
</form>

</body>
</html>


jadz,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top