Link to home
Start Free TrialLog in
Avatar of aliasim99
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_variable" datasource="#Request.dS#">
Select Distinct Field_Name from #request.client#_BASIC_SEARCH_FIELDS
</cfquery>

<cfloop query="qry_get_dropdown_variable">
  <cfparam name="attributes.#Field_Name#" default="">
</cfloop>

<cfdump var="#attributes#">

<cflock timeout="20" type="EXCLUSIVE" scope="Session">
  <cfloop query="qry_get_dropdown_variable">
 <!--- 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_Name#")>
      <cfset Session.#Field_Name# = "#attributes.#Field_Name##">
    </cfif>
  </cfloop>
</cflock>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial