?
Solved

jQuery if select option from parent list, auto populate the child list

Posted on 2014-02-11
5
Medium Priority
?
854 Views
Last Modified: 2014-02-11
Hi,

I need help.

I have Driver Type table

DriverTypeID        Driver    Status       Date
3                  Benefit        1      2014-02-10 00:00:00.000
4                  Billing         1      2014-02-10 00:00:00.000
5                  Blue Card      1      2014-02-10 00:00:00.000
6                  Education      1      2014-02-10 00:00:00.000
7                  Email      1      2014-02-10 00:00:00.000
8                  Group Wide Change      1      2014-02-10 00:00:00.000
9                  ID Card      1      2014-02-10 00:00:00.000
10                   Legal      1      2014-02-10 00:00:00.000
12                  Mailing      1      2014-02-10 00:00:00.000
13                  Media      1      2014-02-10 00:00:00.000
14                  Medical policy      1      2014-02-10 00:00:00.000
15                  New Process      1      2014-02-10 00:00:00.000
16                  Open Enrollment      1      2014-02-10 00:00:00.000
17                  Reform      1      2014-02-10 00:00:00.000


I have DriverSubType table

SubID     DriverTypeID     SubType   Status       Date
1      1                 Hearing      1      2014-02-03 00:00:00.000
2      1                 Medical      1      2014-02-03 00:00:00.000
3      1                 Pharmacy      1      2014-02-03 00:00:00.000
4      1                 Vision      1      2014-02-03 00:00:00.000
5      10                BCBSM      1      2014-02-03 00:00:00.000
6      10                Employer Group      1      2014-02-03 00:00:00.000
7      10                Pharmacy      1      2014-02-03 00:00:00.000
8      10                Provider      1      2014-02-03 00:00:00.000


______________________________________________________________________________

  <SELECT name="SelectDriverType" id="SelectDriverType" style="width:200px;">
             <OPTION>Select ...</OPTION>      
           <cfoutput query="QDriverType">
                  <OPTION value="#QDriverType.DriverTypeID#">#QDriverType.Driver#</OPTION>
                   </cfoutput>
            </SELECT>    

<select id="SelectDriverSubType" name="SelectDriverSubType"  style="width:200px;">
                  </select>  



I need an example of how to populate SelectDriverSubType when user select SelectDriverType

Thanks,
Lulu
____________________________________________________________________
0
Comment
Question by:lulu50
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39850781
I use jquery chained http://www.appelsiini.net/projects/chained
In their sample, notice the ID of the first series matches the class of the 2nd.
<select id="mark" name="mark">
  <option value="">--</option>
  <option value="bmw">BMW</option>
  <option value="audi">Audi</option>
</select>
<select id="series" name="series">
  <option value="">--</option>
  <option value="series-3" class="bmw">3 series</option>
  <option value="series-5" class="bmw">5 series</option>
  <option value="series-6" class="bmw">6 series</option>
  <option value="a3" class="audi">A3</option>
  <option value="a4" class="audi">A4</option>
  <option value="a5" class="audi">A5</option>
</select>

Open in new window

0
 

Author Comment

by:lulu50
ID: 39850856
Scott,

where would I get these files?

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.chained.min.js"></script>
0
 

Author Comment

by:lulu50
ID: 39850914
I got it thank you
0
 

Author Closing Comment

by:lulu50
ID: 39850915
Thanks
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39851096
Sorry, feeding break. Glad you figured it out.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question