I'm using your module and it's working nicely (thanks!)
but we needed to do an ajax submit after this drop-down element was selected, so i added a line to the javascript file which triggers the onchange event of the original select

Line 83:
$('#'+select_id).trigger("onchange");

Comments

drupalninja99’s picture

k i will have a look, i'll test and add. i also think i need to wrap this in drupal behaviors instead of the $(document).ready() to do it the "drupal" way, stay tuned.

drupalninja99’s picture

Status: Needs review » Needs work

Um now I can't find where to put this since I made several changes. If you want give me the line number otherwise I'll have to close this.

thtas’s picture

Line 82 of jquery_dropdown.js

so it would look like this

//this is the event for when you select a fake option
  $("ul.jquery_dropdown_list li a").click(function(){

    $(this).parent("li").parent('ul').parent("div.jquery_dropdown_container").find("div.jquery_dropdown_header").text($(this).text());
    $(this).parent("li").parent('ul').parent("div.jquery_dropdown_container").find("ul.jquery_dropdown_list").hide();

    $("#"+$(this).attr('class')).val($(this).attr('rel'));//set value to select
    
    $(this).trigger("jquery_dropdown_list_refreshed");//trigger the onchange event of our drop down when we click a fake option
    $('#'+select_id).trigger("onchange");
    
    return false;
  });
drupalninja99’s picture

i will see if i can add this in

drupalninja99’s picture

Status: Needs work » Fixed

this is done, added new release which is being packaged

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gabrielu’s picture

I am hooking into my select item with $().change(function(){ ... })
My problem is that the change event does not trigger on $('#'+select_id).trigger("onchange"); but on $('#'+select_id).trigger("change");

Do you know why? Would it be better to replace line 82 from:

 $('#'+select_id).trigger("onchange");

to

 $('#'+select_id).trigger("change");

Thanks,
Gabriel

gabrielu’s picture

Status: Closed (fixed) » Active