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,
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,