3 Replies Latest reply on Apr 23, 2007 10:31 PM by Exmachin4

    Dynamic selected drop down menu

    Exmachin4 Level 1
      We have a drop down menu that users use to select their industry.
      The issue comes when they go to edit their industry it defaults to the first one in the list and not the one they selected originally.
      Hope this makes since, can any one help me?
        • 1. Re: Dynamic selected drop down menu
          Level 7
          not without seeing your code...
          --

          Azadi Saryev
          Sabai-dee.com
          http://www.sabai-dee.com
          • 2. Re: Dynamic selected drop down menu
            Daverms Level 3
            Hi,

            Lets say this is your industry select query,

            <cfquery name="Q_SelectIndustry" datasource="#your_data_source#>
            select industry_name,industry_id,address,city from tbl_industry
            </cfquery>

            And the other query which is actullay used to populate the edit form,

            <cfquery name="Q_userInfo" datasource="#your_data_source#>
            select firstname,lastname,industry_selected,etc,etc, from tbl_industry
            </cfquery>



            Then inside your <form> tag (in where you actually have the drop down box) your code should be looking like this,

            <select name="cboIndustry>
            <cfloop query="Q_SelectIndustry">
            <option value=#industry_id# <cfif #Q_userInfo.industry_selected# eq #Q_SelectIndustry.industry_id#>selected</cfif>>#industry_name#</option>
            </cfloop>
            </select>
            • 3. Dynamic selected drop down menu
              Exmachin4 Level 1
              Following the above steps i get the error...

              Complex object types cannot be converted to simple values.
              The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.
              The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions.