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 3628014
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:57:43+00:00 2026-05-18T23:57:43+00:00

I’m having some issues with dijit.form.Select items. In a page i have two of

  • 0

I’m having some issues with dijit.form.Select items.

In a page i have two of these items: one is filled while the html page is being loaded and the other one is filled depending on which option the user has selected on the first one.

Here’s an example of what I’m talking about (now I’m keeping the code simple, but in the real version I’ve included all the necessary dojo modules and libraries in the head section):

<html> 
        <head> 
                <script type="text/javascript"> 
                        function updateB(val){ 

                                var menu = dojo.byId("selB"); 

                                menu.options.lenght=0; 

                                if(val=="aaa") 
                                        menu.addOption({value: "aa", label: "aa"}); 
                                else 
                                        menu.addOption({value: "bb", label: "bb"}); 
                        } 
                </script> 
        </head> 

        <body> 
                <select id="selA" name="selA" dojoType="dijit.form.Select" style="width: 180px;" onchange="updateB(this.get('value'));"></select> 

                <select id="selB" name="selB" dojoType="dijit.form.Select" style="width: 180px; "></select> 

                <script type="text/javascript"> 
                        var menu = dojo.byId("selA"); 

                        menu.addOption({value: "aaa", label: "aaa"},{value: "bbb", label: "bbb"}); 

                </script> 

        </body> 

</html>

When I load the page in my browser, menu selA contains the options aaa and bbb. But selB, whenether I select aaa or bbb in selA remains empty. In javascript error console i can read: dojo.byId [undefined] is not a function. I’ve spent a lot of time trying to make this work (tryied a lot of alternatives) but had no luck. I can only manage to fill dojo select on onload events, not on onchange (associated with another select) or onclick (associated to a button). With standard HTML select items everything works ok instead.
What can I do in order to fix this issue?

Thanks

  • 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-18T23:57:43+00:00Added an answer on May 18, 2026 at 11:57 pm

    Here is more or less your working example

    <html> 
        <head> 
                <link href="js/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" />
                <script type="text/javascript" src="js/dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
    
                <script type="text/javascript"> 
                        dojo.require("dijit.form.Select");
                        function updateB(val){ 
                                var menu = dijit.byId("selB"); 
                                menu.options.lenght=0; 
                                if(val=="aaa") 
                                        menu.addOption({value: "aa", label: "aa"}); 
                                else 
                                        menu.addOption({value: "bb", label: "bb"}); 
                        } 
                        dojo.addOnLoad(function()
                        {
                            var menu = dijit.byId("selA"); 
                            menu.addOption([{value: "aaa", label: "aaa"},{value: "bbb", label: "bbb"}]); 
                        });
                </script> 
        </head> 
    
        <body> 
                <select id="selA" name="selA" dojoType="dijit.form.Select" style="width: 180px;" onchange="updateB(this.get('value'));"></select> 
                <select id="selB" name="selB" dojoType="dijit.form.Select" style="width: 180px; "></select> 
        </body> 
    

    What I have changed:

    • moved code that setup selA Select to
      dojo.addOnLoad. This is required,
      because previously when you were tried
      to get selA widget it wasn’t fully
      created and dojo couldn’t return its
      widget yet. Dojo create its widgets
      after page is fully loaded. After
      it creates everything it calls
      addOnLoad function. So you should
      place in this function all your
      initialization stuff.
    • Select is a dijit kind of widget so
      dijit.byId should be used instead of
      dojo.byId.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.