Skip to content

Instantly share code, notes, and snippets.

@PintuKumarPal
Last active December 25, 2015 07:29
Show Gist options
  • Save PintuKumarPal/6939596 to your computer and use it in GitHub Desktop.
Save PintuKumarPal/6939596 to your computer and use it in GitHub Desktop.
<cfoutput>
<cfform name="registration" id="registration">
<h2>Detailed Registration:</h2>
<cfquery name="getStates" datasource="TestDB">
select *
from shema_countries
</cfquery>
<div class="registrationLabel">
Country
</div>
<div class="registrationValue">
<cfselect name="Country" id="Country">
<option id="state0" value="0">--State--</option>
<cfloop query="getStates">
<option id="state#ctr_code#" value="#ctr_code#">#ctr_name#</option>
</cfloop>
</cfselect>
</div>
<div class="registrationLabelNS" style="width:65px;">
State
</div>
<div class="registrationValue">
<cfselect name="State" id="State" bind="cfc:update.myFunction1({Country})" bindOnLoad="yes" display="StateName" value="StateID" selected="" style="width:220px;" />
</div>
</cfform>
</cfoutput>
<cfcomponent>
<cffunction name="myFunction1" access="remote" returntype="any">
<cfargument name="Country" type="string" required="yes">
<cfquery name="getCities" datasource="TestDB">
select *
from shema_states
where StateCtrCode = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Country#">
order by StateName
</cfquery>
<cfreturn getCities>
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment