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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:08:35+00:00 2026-05-16T08:08:35+00:00

I have a dojo (dijit) select dropdown that calls a js function onChange. I

  • 0

I have a dojo (dijit) select dropdown that calls a js function onChange. I was expecting this to only call the onChange function when the user changes the value in the dropdown, however, it even calls the onChange function when I programmatically change the value of the dropdown from js code. How do I get it to only call the function when the user changes the dropdown value? It shouldn’t call the function when I programmatically change the value.

<select jsId="ddlBoundaryType" id="ddlBoundaryType" name="ddlBoundaryType" 
                            dojoType="dijit.form.Select">
                            <option value="0">Circle</option>
                            <option value="1">Polygon</option>
                        </select>

dojo.addOnLoad(InitBoundaries);
    function InitBoundaries() {
        dojo.connect(dijit.byId("ddlBoundaryType"), 'onChange', Boundaries_ChangeBoundaryType); 
    }
  • 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-16T08:08:35+00:00Added an answer on May 16, 2026 at 8:08 am

    I think the proper fix in this case for you would be http://bugs.dojotoolkit.org/ticket/10594, since it deals directly with dijit.form.Select. Of course, there are a few ways to fix this.

    1. Upgrade dojo :).
    2. Inherit dijit.form.Select and “patch” the _updateSelection function.
    3. Extend dijit.form.Select and “patch” it directly there.

    I will forgo the first. The the second and the third method are similar, so I will just post a simple fix using the third way,

    dijit.form.Select.extend({
       _updateSelection: function() {
            this.value = this._getValueFromOpts();
            var val = this.value;
            if(!dojo.isArray(val)){
                val = [val];
            }
            if(val && val[0]){
                dojo.forEach(this._getChildren(), function(child){
                    var isSelected = dojo.some(val, function(v){
                        return child.option && (v === child.option.value);
                    });
                    dojo.toggleClass(child.domNode, this.baseClass + "SelectedOption", isSelected);
                    dijit.setWaiState(child.domNode, "selected", isSelected);
                }, this);
            }
       }
    });
    

    Note that I did not write this function, I happily plagiarized it from the source code with the last line, this._handleOnChange(this.value) removed.

    myWidget.attr('value', newValue, false) // should now work without firing onChange.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic dojo form in which I have a dijit.form.Select whose selected
I have a Dojo dialog that is opened when a user clicks on an
I have a dijit.form.Select widget. It's tied to a data store, if that matters.
I have the following source code for a select: <select id=_conteneurNum_id name=conteneurNum data-dojo-type=dijit.form.FilteringSelect> <option
I have this dojo TimeTextBox in the HTML: <input type=text id=startTime value= dojoType=dijit.form.TimeTextBox></input> and
I am not familiar with dojo. I have this application I am using that
I have the following code in my page that creates a new Dojo/Dijit TabContainer.
I have a problem with dijit editor of dojo: I used execCommand to insert
I have 2 dijit widget template classes and am trying to call one from
I'm using dojo and dijit and have an inlineEditBox widget. I'm trying to capture

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.