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

  • Home
  • SEARCH
  • 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 7806481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:33:01+00:00 2026-06-02T02:33:01+00:00

I am triggering a change event on a combo box for multiple values but

  • 0

I am triggering a change event on a combo box for multiple values but unfortunately events are getting lost. Is there a way to wait for one event to complete before triggering the next event. Sample code is shown below

        for (i = 0; i < contextFilters.length; i++)
        {
            var contextFilter = contextFilters[i];
            if (contextFilter != "")
            {
                var cfData = contextFilter.split(":");
                var cfName  = cfData[0];
                var cfVal = cfData[1];
                if (cfName != null)
                {
                    //alert("cfName : " + cfName);
                    //alert("cfVal : " + cfVal);
                    $('#context_filter').val(cfName);
                    $('#context_filter').trigger('change', cfVal);                        
                }
            }
        }

When the event is triggered a new select box is added to the DOM but not all select boxes are getting added.

Also the change event handler is a s shown below

$('#context_filter').change(function(event, selectValues)
{
    if ($(this).prop("selectedIndex") > 0)
    {
        populateDateValues();
        var contextFilterComboObject = $(this);
        var selectedVal = $(contextFilterComboObject).val();
        var validate = $('#collapsiblePanel :input').attr('disabled') == null;
        if (!validate)
        {
            $('table[id*=OtherOptions] :input').attr('disabled', false);
            $('#collapsiblePanel :input').attr('disabled', false);
        }
        var formInput = decodeURIComponent($('#rptInputParams').serialize());
        formInput += "&validate=" + validate;
        $('#ajaxBusy').show();
        $.getJSON('GetContextFilterData', formInput, function(data)
        {
            var selectBox = '<tr><td class="celltoppad"><b>' + selectedVal +
                    ' : </b></td> <td class="celltoppad"><select multiple="multiple" name="' +
                    selectedVal.toLowerCase() + '" id="' + selectedVal.toLowerCase() + '" >';
            var errorMsg = '';
            var errorCount = 1;
            errorMsg += '<html>';
            $.each(data.errorMessageList, function(index, value)
            {
                errorMsg += errorCount + ') ' + value + '</br></br>';
                errorCount++;
            });
            errorMsg += '</html>';

            if (errorCount > 1)
            {
                $('#ajaxBusy').hide();
                showErrorDialog(errorMsg, errorCount * 20);
                $(contextFilterComboObject).prop("selectedIndex", '0');
                return;
            }

            $.each(data.contextFilterDataList, function(index, value)
            {
                selectBox += '<option value="' + value + '">' + value + "</option>";
            });

            selectBox +=
                    '</select></td><td class="celltoppad"><a href="#"><img id="removeCF" ' +
                            'src="../images/remove.png"/></a></td></tr>';

            $('#ajaxBusy').hide();
            // If the context filter has not been already added.
            if ($('#' + selectedVal.toLowerCase()).length == 0)
            {
                $('a[id*=_showDialog]').hide();
                toggleDatePickerLink();
                $('img#removeDate').hide();
                $('table[id*=OtherOptions] :input').attr('disabled', true);
                $('#collapsiblePanel :input').attr('disabled', true);
                $('table#context_filter').append(selectBox);                    
                $(contextFilterComboObject).prop("selectedIndex", '0');
            }

            if (selectValues != null)
            {
                $('#' + selectedVal.toLowerCase()).val(selectValues.split(","));
            }

            $('#' + selectedVal.toLowerCase()).multiselect({
                noneSelectedText: 'Please select',
                selectedList: 3,
                selectedText: '# of # selected',
                position: {
                    my: 'left center',
                    at: 'right center',
                    offset: '20 100'
                }
            }).multiselectfilter();
        });
    }
});
  • 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-06-02T02:33:03+00:00Added an answer on June 2, 2026 at 2:33 am

    I was able to figure out the solution to my problem, when the back button is clicked and the change event is fired then I made the ajax call using async as false and that resolved the issue. This is because if the async is true json calls happen simultaneously and some events are lost during that period.

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to programmatically trigger the change event. This I can usually do, but
What is the easiest and best way to trigger change event when setting the
Is there a way for listening for value change of a variable in Javascript
I am working on triggering an event to create a page automatically, when user
i have a problem with triggering the multiple alarm at first time , here
I want to prevent iframe elements from triggering the OnDocumentComplete event every time. For
Possible Duplicate: Throttle event calls in jQuery I like the .change() functionality of jQuery,
I have a problem with onLocationChanged event in Android. Here's the triggering: case R.id.start:
Normally, when a user selects an item in a <select> , the 'change' event
I currently have a datepicker with month and year change set to true... but

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.