Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad jQuery Dialog with cascading dropdowns from server
    primarykey
    data
    text
    <p>I have a jQuery dialog that needs to be opened and populated with data from a database. The dialog has in it drop downs that when in a "new" mode (not editing for re-saving) cascade. </p> <p>How can I load the dialog with the values from the database, while at the same time causing the cascading to happen.</p> <p>I have tied using the onfocus event of the dialog when the dialog is in "edit" mode, but the focus hit every time an element gets focus. Didn't work without being sneaky with the editing mode.</p> <p>I have tried opening the dialog and using jQuery to set the dropdown, which works, but then the cascading does work.</p> <p>For the cascading I am using .change on the the different dropdowns.</p> <p>Not sure if the code is going to help, but will post some to itterate the jQuery functionality I am using.</p> <p><strong>The question is: How do I open a dialog, load dropdowns with information from the server and have the .change functionality work?</strong></p> <pre><code>$('#collectDD').change(function(){ // first change the item drop down list var collection = $('#collectDD').val(); data = "coll=" + collection + "&amp;action=getItems&amp;func="; $('#addCollection').text(collection); $.ajax({ url: "getItemList.php", type: "GET", cache: false, data: data, success: function (html) { $('#itemDD').empty(); $("#itemDD").html(html); // now update the function collection dropdown data = "coll=" + collection + "&amp;action=getFunction"; } }); </code></pre> <p>Collection DD HTML</p> <pre><code> &lt;select id="collectDD" name="collectionDD"&gt; &lt;option&gt;Select Collection&lt;/option&gt; &lt;option&gt;Option1&lt;/option&gt; &lt;/select&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload