3 Replies Latest reply on Sep 27, 2016 6:21 AM by WolfShade

    Select to select

    ZNB Level 1


      I do not find on the site.

      I would select a select a.

      In the first, we choose the category and in the second, the elements of the chosen category.

      I would like this without jquery.

      Thank you for your help

      Jean Marie

        • 1. Re: Select to select
          WolfShade Level 4

          Hello, ZNB,


          You will probably be tempted to use CFFORM and CFSELECT to do this.  The bind parameters make it easy.  But I would advise against using CFFORM.  I know of no veteran developer who uses CFFORM (unless there's one, here, who isn't telling me.)


          What you ask for is commonly done using a combination of ColdFusion and JavaScript or jQuery.  You create one SELECT, either manually or by a database query, and then use JavaScript or jQuery to apply an event handler to that first SELECT that will use AJaX to pass the value of the chosen SELECT item to a ColdFusion CFC that will get the values for the second SELECT based upon the first SELECT value, and use JavaScript or jQuery to populate the options of the second SELECT.





          • 2. Re: Select to select
            ZNB Level 1


            Thank you for your reply.

            Indeed,I used a cfform! [  ]

            Can I please havean example because I am a beginner.

            Thanks in advance.

            Best regards


            Jean-Marie BUSSELET

            • 3. Re: Select to select
              WolfShade Level 4

              I intend no offense, ZNB, but these forums are for helping troubleshoot code that isn't working.  Occasionally, if a request is small enough, someone might write it all out.  But what you are requesting is a bit bigger.  We are not here to write code, for you.  Especially if it's for homework, which I'm getting the distinct feeling that is why you are asking.


              Perform a Google search for "related selects" and view the sample codes that you find.


              I can tell you that you will need a CFC to contain the functions that will supply the data for the selects, and every SELECT tag (except the last one) should have an "onChange" attribute that will trigger a JavaScript function which will use AJaX to call the CFC functions that will return data used to populate the next SELECT with options.