Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Invoke cfquery for state/province retrieval when country selected on same page

Avatar of Ian White
Ian WhiteFlag for Australia asked on
JavaScriptWeb Servers
4 Comments1 Solution432 ViewsLast Modified:
I have a coldfusion generated selection list that defaults a country selection according to visitor location.

Further down the page is a state/ province list with a select query with the country input from the country selected in the list above.

I want to pass the country to the  query depending on reselection of country so the appropriate states/provinces selection is selected further down the page without the user havin to leave the page.

Eg May arrive on page with Canada preselected but visitor may want to select USA , Australia etc.  

The dynamic/ select  input field is free format entry for countries without states,

Solution using ColdFusion6/  java script
Tip of page

<cfinclude template = "include_country_select_housaesit.cfm">

  <CFSWITCH EXPRESSION="#PassedCountry#">
  

	
 	<CFCASE Value="Australia,United States,Canada">
	
	    <cfif isDefined ("url.sta")
		and url.sta GT " ">
		
		<cfoutput>
		<CFSELECT Name="Crit1_Value" 
		Message="Please select State " 
		QUERY="GetStates"
		Size=1 
		Value="State"
		Selected = "#url.sta#"
		Display="State"
		Required="Yes">
		</CFSELECT>
		</cfoutput>
 	   
	   <cfelse>
	   
	    <CFSELECT Name="Crit1_Value" 
		Message="Please select State " 
		QUERY="GetStates"
		Size=1 
		Value="State"
		Display="State"
		Required="Yes">
		</CFSELECT>
		
		</cfif>
		
	</CFCASE>
	<CFDEFAULTCASE>
		<CFINPUT Type="Text" Name="Crit1_Value" 

		Maxlength="30"
		Size="20"  >
	</CFDEFAULTCASE>
	
</CFSWITCH>
ASKER CERTIFIED SOLUTION
Avatar of Ian White
Ian WhiteFlag of Australia imageOwner and Founder

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers