Skip to main content
Inspiring
Sep 19, 2013 10:28 PM UTC
Answered

select value base on previous select value

I have 5 select on the form and each one uses different data source from the query like following.

I want to every one data limite by previous dropdown just like department, manager, supervisoe, leader and employees.

If user select the first one department 1 then all the rest dropdown only shows department one managers, supervisors, leaders and employees.

If user select one supervisors than only employee in hos or her group available for the users.

I need pass client, previous value to the server and send back to client the rest of dropdown box.

Any better way to handle this issue?

Your help and information is great appreciated,

Regards,

Iccsi,

  <select name="MyList1" id="MyList1">

  <cfoutput query="Myquery1">

   <option value="#MyQuery1.MyID#">#MyQuery1.Mycode#</option>

  </cfoutput>

  </select>

<select name="MyList2" id="MyList2">

  <cfoutput query="Myquery2">

   <option value="#MyQuery2.MyID#">#MyQuery2.Mycode#</option>

  </cfoutput>

  </select>

<select name="MyList3" id="MyList3">

  <cfoutput query="Myquery3">

   <option value="#MyQuery3.MyID#">#MyQuery3.Mycode#</option>

  </cfoutput>

  </select>

<select name="MyList4" id="MyList4">

  <cfoutput query="Myquery4">

   <option value="#MyQuery4.MyID#">#MyQuery4.Mycode#</option>

  </cfoutput>

  </select>

<select name="MyList5" id="MyList5">

  <cfoutput query="Myquery5">

   <option value="#MyQuery5.MyID#">#MyQuery5.Mycode#</option>

  </cfoutput>

  </select>

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    Sep 19, 2013 11:03 PM UTC

    You are going to have to do some JavaScript/AJAX work to update the option values for the last four dropdowns.  Using jQuery this isn't terribly difficult, and there are a number of blog posts and jQuery plugins out there to accomplish this.  Try Googling "jQuery chained select".

    -Carl V.

    3 replies

    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    Sep 19, 2013 11:03 PM UTC

    You are going to have to do some JavaScript/AJAX work to update the option values for the last four dropdowns.  Using jQuery this isn't terribly difficult, and there are a number of blog posts and jQuery plugins out there to accomplish this.  Try Googling "jQuery chained select".

    -Carl V.

    Translate
    iccsiAuthor
    Inspiring
    Sep 19, 2013 11:11 PM UTC

    Thanks a million for the informaiton and help,

    Yes, jQuery chain  Select is what I am looking for,

    Thanks again,

    Regards,

    Iccsi,

    Translate