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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing javascript variable to another page

Status
Not open for further replies.

vavolunteer

Programmer
Jan 24, 2007
1
US
Hello everyone. I beg forgiveness early as I am new to this forum. I am using ColdFusionMX with MS SQL and just starting to learn Javascript.

I have a CFFORM page where a user provides contact information. Within this form I also have a Javascript dropdown select menu. This drop down pulls a listing of facilities from a table in my SQL database. The facility selected will be used to determine the program manager the contact information is sent to by CFMAIL.

My problem: How do I pass the Javascript select variable to the next page (a .cfm preview page)? I get the ELEMENT Staname UNDEFINED in FORM, but can't figure out what is missing.

Here is the Javascript code:

<cfset idx = -1>
<cfset mycase = 0>
<!---JavaScript--->
<script language="JavaScript1.2">
function whichLocal(obj){
switch (obj.selectBorder.selectedIndex){
<!--- use the group attribute to group output by category --->
<cfoutput query="getLocation" group="dState">
<cfset mycase = mycase + 1>case #mycase#:
<cfset myList = ValueList(getLocation.Staname)>
<cfset numberInState = ListValueCount(myList, Staname)>
obj.selectLocal.length=#numberInState#<cfoutput><cfset idx = idx + 1>
obj.selectLocal.options[#idx#].value="#getLocation.STA6A#"
obj.selectLocal.options[#idx#].text="#getLocation.STA6A#"</cfoutput>

break;

<cfset idx = -1>
</cfoutput>
}
}
</script>

And my preview page code:

<cfform action="Submit_DB_TEST.cfm" method="post" name="vavolunteer">
<strong>Volunteer Opportunity Location</strong>
City:<input type="text" name="Staname" value=<cfoutput>"#form.Staname#"</cfoutput>>

<br>
First Name:<input type="text" name="FName" value=<cfoutput>"#form.FName#"</cfoutput>>
Last Name:<input type="text" name="LName" value=<cfoutput>"#form.LName#"</cfoutput>> <p></p>
Address:<input type="text" name="Address" value=<cfoutput>"#form.Address#"</cfoutput>> <p></p>
City:<input type="text" name="City" value=<cfoutput>"#form.City#"</cfoutput>> <spacer></spacer>
State:<input type="text" name="State" value=<cfoutput>"#form.State#"</cfoutput>> <spacer></spacer>
Zip Code:<input type="text" name="ZIPCODE" value=<cfoutput>"#form.ZIPCODE#"</cfoutput>> <p></p>
Phone:<input type="text" name="Phone" value=<cfoutput>"#form.Phone#"</cfoutput>> <spacer></spacer>
Email:<input type="text" name="Email" value=<cfoutput>"#form.Email#"</cfoutput>> <p></p>
Additional Comments:<input type="text" name="Why" value=<cfoutput>"#form.WHy#"</cfoutput>> <p></p>
Preferred Method of Contact:<input type="text" name="Contact" value=<cfoutput>"#form.Contact#"</cfoutput>> <p></p>


<input name="Save Information" type="Submit" value="Submit">
<input name="Reset" type="reset" value="Clear">
</cfform>

Thanks for any help.

Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top