Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to populate a drop down with values from JavaScript?
    primarykey
    data
    text
    <p>I added a button to the ribbon toolbar button in my extension to the Tridion CMS. On click of the button a popup page will display with two drop downs. By changing the values in the first drop down control I should populate the values for second drop down control. In my case I am using <code>ASP drop down list</code> control. For the time being I will hard code the values to be populated to the second drop down in java script. For this requirement I am using the following code but I am not able to populate the value (Not Identifying the tag).</p> <p>Java script code:</p> <pre><code>ABC.WCMS.RTFExtension.Popups.ButtonPopup.prototype._populate = function () { var selectedValue = $('#functionalcomponent').value;//First dropdown selected value var dropdownId = $("#Dd");//Second Dropdown Control switch (selectedValue) { case "Home Ware": dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("Select Sub-Category").html("")); dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("Air-Conditioners/Coolers").html("Air-Conditioners/Coolers")); break; case "Education": dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("Select Sub-Category").html("")); dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("Colleges").html("Colleges")); break; default: dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("Select Sub-Category").html("")); dropdownId.append($("&lt;option&gt; &lt;/option&gt;").val("No Value").html("No Value")); } return true; } </code></pre> <p>ASPX Controls:</p> <pre><code>&lt;%--Dropdown1--%&gt; &lt;asp:DropDownList ID="functionalcomponent" runat="server"&gt;&lt;/asp:DropDownList&gt; &lt;%--Dropdown2--%&gt; &lt;asp:DropDownList ID="Dd" runat="server"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p>How can I populate the values for second drop down from external JavaScript file?</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.
 

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