Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate one select on the basis of another select
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/10566114/how-to-load-second-dropdown-list-from-database-after-first-dropdown-list-is-chan">How to load second dropdown list from database after first dropdown list is changed</a> </p> </blockquote> <p>Hey I have a form with two select dropdowns in it. </p> <p>The first select is populated with the portfolios of a user and the 2nd one needs to be populated with the portfolio groups. I get all the portfolios of the logged in user and populate the 1st select with those portfolios now I want to populate the 2nd select with the groups on the basis of 1st select, For-example if user select portfolio_1 all the groups in the portfolio_1 should be loaded in the 2nd select box.</p> <p>The 1st select with portfolios is:</p> <pre><code>&lt;select id="portfolios" name="portfolio" style="width: 200px; height:25px;"&gt; &lt;option selected="selected" value="default"&gt;Select Portfolio&lt;/option&gt; {% for portfolio in portfolios %} &lt;option value={{ portfolio.id }}&gt;{{ portfolio.portfolioName }}&lt;/option&gt; {% endfor %} &lt;/select&gt; </code></pre> <p>What I understand is I need to call an ajax function onchange of the 1st select in that ajax I need to send the selected portfolio id and find all the groups with that id and then return all those groups and update only the 2nd select box with those groups, </p> <p>I dont know how can I populate the 2nd select with the groups I will get</p> <p>any ideas?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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