Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 546857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:54:39+00:00 2026-05-13T10:54:39+00:00

Scenario: I have a standard dropdown list and when the value in that dropdownlist

  • 0

Scenario: I have a standard dropdown list and when the value in that dropdownlist changes I want to update another dropdownlist that exists in a tinyMCE control.

Currently it does what I want when I open the page (i.e. the first time)…

function changeParent() {

    }

tinymce.create('tinymce.plugins.MoePlugin', {
            createControl: function(n, cm) {
                switch (n) {
                    case 'mylistbox':
                        var mlb = cm.createListBox('mylistbox', {
                            title: 'Inserts',
                            onselect: function(v) {
                                tinyMCE.execCommand("mceInsertContent",false,v);                                                                
                            }
                        });

                        <% foreach (var insert in (ViewData["Inserts"] as List<String>)) { %> // This is .NET 
                            yourobject = '<%= insert %>'; // This is JS AND .NET
                            mlb.add(yourobject, yourobject); // This is JavaScript
                        <% } %>                       

                        // Return the new listbox instance
                        return mlb;
                }
                return null;
            }
        });             


<%= Html.DropDownList(Model.Record[184].ModelEntity.ModelEntityId.ToString(), ViewData["Containers"] as SelectList, new { onchange = "changeParent(); return false;" })%>

I am thinking the way to accomplish this (in the ChangeParentFunction) is to call a controller action to get a new list, then grab the ‘mylistbox’ object and reassign it, but am unsure how to put it all together.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:54:40+00:00Added an answer on May 13, 2026 at 10:54 am

    Step 1 – Provide a JsonResult in your controller

        public JsonResult GetInserts(int containerId)
        {
            //some code to get list of inserts here 
            List<string> somedata = doSomeStuff();
    
            return Json(somedata);
        }
    

    Step 2 – Create javascript function to get Json results

    function getInserts() {
        var params = {};
        params.containerId = $("#184").val();
        $.getJSON("GetInserts", params, updateInserts);
    };
    
    updateInserts = function(data) {
        var insertsElem = document.getElementById("183_mylistbox");
    
        insertsElem.options.length = 1;  // Remove all but the first option.
    
        var optElem = document.createElement("option");
        for (var item in data) {
            optElem = document.createElement("option");
            optElem.value = item;
            optElem.text = data[item];
    
            try {  
                insertsElem.add(optElem, null); // standards compliant browsers  
            }  
            catch(ex) {  
                insertsElem.add(optElem, item+1); // IE only (second paramater is the items position in the list) 
            }
        }
    };
    

    Step 3 – Create NativeListBox (code above provided by ZoogieZork above)

    var mlb = cm.createListBox('mylistbox', {
        title: 'Inserts'
    }, tinymce.ui.NativeListBox);
    
    // Set our own change handler.
    mlb.onPostRender.add(function(t) {
        tinymce.dom.Event.add(t.id, 'change', function(e) {
            var v = e.target.options[e.target.selectedIndex].value;
            tinyMCE.activeEditor.execCommand("mceInsertContent", false, v);
            e.target.selectedIndex = 0;
        });
    });
    
    //populate inserts on listbox create
    getInserts();  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: I have several services that I want to be discovered by different clients.
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Scenario: I have a console application that needs to access a network share with
I have a scenario where I want to show hierarchical data in a DataGrid
Here's the scenario: I have a standard applicationConfig.xml spring configuration for a basic web
Here's the scenario: I have a standard applicationConfig.xml spring configuration for a basic web
Here's the scenario: You have two seperate websites that exist in different environments (I.E.
In a standard WinForms application, is it possible to have a scenario like the
I have a scenario that I'm struggling to find a clean solution to. In
I have a form that I have been submitting to Salesforce with standard form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.