How to get selection from 2nd dropdown list from template

23 views
Skip to first unread message

31113...@gmail.com

unread,
Dec 31, 2018, 5:04:25 PM12/31/18
to Django users
Hello,

I am a newbie to Django.  I am trying to build a page with dependent dropdown lists.  The second list is populated based on the 1st list selection.  I am using one html template for both dropdowns with select ids.   I used the .change jquery script to grab the first dropdown selection with .ajax call to populate the second list via python script to my database.  This works but I don't know how to trigger the select from the 2nd dropdown.  Currently the return from the python script renders a small snippet of html which loads the option list but does not include the select id.  Tried the .change jquery script on the 2nd dropdown select id, but nothing happens.  I suspect that since the html snippet only contains loading the option list that there is no visibility to the select id tag for this dropdown in the original html template.  Also, since there is no id in this snippet I cannot uniquely identify the selection for the jquery function call.

How can I trigger the select on the 2nd dropdown to send the selection back to a python script for processing?

I included my html templates for your reference.  Any help would be appreciated!

Thanks,
Debbie
lockop.html
lock_dropdown_list_options.html
Reply all
Reply to author
Forward
0 new messages