The second way involves either Javascript or AJAX to make the second dropdown dependent on the value of the first. Unfortunately, every tutorial I’ve found on this so far hasn’t included a way to pass the option value of the second dropdown to the Advanced Search form in EE. The option values for the second select dropdown don’t show up in the page source, so I can’t give the select element an
value, so the Advanced Search form recognizes it.
I see in the source of your page that the second dropdown has all of its option values. Were those hard-coded? It looks like you have multiple “second dropdowns”, all pre-populated, but hidden. Once a user selects an option from the first dropdown, you use jquery to unhide the relevant div? Is that how it works?
Thanks a lot for your help.
you got it,, that is how it works, I preload all, and with this jquery I show and hide <select>
//action for first select
$("select#parentCat").change(function () {
//hide all sub selects
$("select.podKategorijeSelect").css({ display:"none" });
// I made function for taking the values because I wanted if someone enter to direct link, have all opened
uzmiVrijednosti();
//displaying the right select, "selektiran" is ID of category group
$("select#" + selektiran).css({ display:"block" });
//action for second select
$("#podKategorije select").change(function () {
//again taking values
uzmiVrijednosti();
//displaying "search" button
$("#idemo").css({ display:"inline" });
});
});
//taking values from selects
function uzmiVrijednosti() {
selektiran = $("select#parentCat option:selected").val();
imeSelektiranog = $("select#parentCat option:selected").attr("id");
selektiran2 = $("select#" + selektiran + " option:selected").val();
podSelektiran = $("select#" + selektiran + " option:selected").attr("id");
};
//it selects the first select if some category is opened
{if segment_2 != ""}
uzmiVrijednosti();
$("select#" + selektiran).css({ display:"inline" });
$("#idemo").css({ display:"inline" });
{/if}
I made some some effect that I didn’t post here, you can check it in the jquery directly, they are for check if all selects are selected and then it redirect page to it.
I hope you get it, at least for doing what you are doing.
as I could see, you are trying to do this for advanced search, with my button I redirect my page, but you could use form submit also with jquery, or generally with javascript.
dp