aliasim99
asked on
Dynamic variables with Coldfusion
I've created a dropdown that gets populated dynamically. For this drop down I need variables in Attributes scope and in Session scope. This is a search page. when submitted I write Attributes value to session variables to maintain search criteria. This has been working just fine until now when the client is asking for dynamic dropdowns. Could someone please tell me how this can be done. Below is code, I have a problem when I'm trying to write Attributes value to session variable.
<cfquery name="qry_get_dropdown_var iable" datasource="#Request.dS#">
Select Distinct Field_Name from #request.client#_BASIC_SEA RCH_FIELDS
</cfquery>
<cfloop query="qry_get_dropdown_va riable">
<cfparam name="attributes.#Field_Na me#" default="">
</cfloop>
<cfdump var="#attributes#">
<cflock timeout="20" type="EXCLUSIVE" scope="Session">
<cfloop query="qry_get_dropdown_va riable">
<!--- I have problems below this line of how to check if the lenth is greater than 0 means this field was submitted by the form --->
<cfif len("attributes.#Field_Nam e#")>
<cfset Session.#Field_Name# = "#attributes.#Field_Name## ">
</cfif>
</cfloop>
</cflock>
<cfquery name="qry_get_dropdown_var
Select Distinct Field_Name from #request.client#_BASIC_SEA
</cfquery>
<cfloop query="qry_get_dropdown_va
<cfparam name="attributes.#Field_Na
</cfloop>
<cfdump var="#attributes#">
<cflock timeout="20" type="EXCLUSIVE" scope="Session">
<cfloop query="qry_get_dropdown_va
<!--- I have problems below this line of how to check if the lenth is greater than 0 means this field was submitted by the form --->
<cfif len("attributes.#Field_Nam
<cfset Session.#Field_Name# = "#attributes.#Field_Name##
</cfif>
</cfloop>
</cflock>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.