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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:57:15+00:00 2026-06-07T03:57:15+00:00

Question How can I get this sequence to fire when a user takes action

  • 0

Question

How can I get this sequence to fire when a user takes action instead of on load?

Background

I have three <select> menus chained together: country, region, city. The options presented in region depend on the value selected in country, and the options presented in city depend on the value selected in in region. For example, if you select “United States” from country, the options in region will be the 50 states, and so on. Country is the only menu that’s always static. Region and city menu options are populated dynamically depending on what the user has selected from the preceding menus. When values from country or region are selected, the options for their chained sub-menus are fetched from the server. This process is fired on $(selectID).change(). I’m using the Chained Selects jQuery Plugin to accomplish this. Specifically, I’m using the “remote” version of the API (source code).

The structure of the <select> menus:

<select id="country">
  <option value="0">Select country...</option>
  <option value="1">Country 1</option>
  <option value="2">Country 2</option>
  ...
</select>

<select id="region">
  <option value="0">Select region...</option>
  <option value="1">region 1</option>
  <option value="2">region 2</option>
  ...
</select>

<select id="city">
  <option value="0">Select city...</option>
  <option value="1">city 1</option>
  <option value="2">city 2</option>
  ...
</select>

By way of the chaining API, the <select> menus are chained together in $(document).ready() as follows:

$('#region').remoteChained('#country', 'server.php');
$('#city').remoteChained('#region', 'server.php');

Problem

These <select> menus are part of a search interface. This interface remembers the user’s most recent search. Say, for example, the user’s most recent search was “United States > Louisiana > New Orleans”, the <select> items on the page should then initially be rendered as follows (the chaining API should not come into play at all yet at this point):

<select id="country">
  ...
  <option value="113" selected>United States</option>
  ...
</select>

<select id="region">
  ...
  <option value="1390" selected>Louisiana</option>
  ...
</select>

<select id="city">
  ...
  <option value="17267" selected>New Orleans</option>
  ...
</select>

But what ends up happening is, when the $(selectID).remoteChained(...) functions are called in $(document).ready(), the region and city select options are overwritten by values fetched from the server, and the “selected” options are lost (the entire list of initial <option> items for region and city are lost, in fact). Using the example saved search above, the options for each of the three select options should initially be pre-selected to 1) United States 2) Louisiana 3) New Orleans but instead are 1) United States 2) Select region… 3) Select city… In other words, the <select> menus should only be built dynamically when the user has physically changed one of the values, never on page load.

Any advice on how to avoid fetching the new select options on page load, and do it only when select options are physically changed by the user? I’ve tried calling the remoteChained() function in $(selectID).change() but run into recursion issues that overload the stack, so that doesn’t work.

Thanks in advance for any ideas you might have.

  • 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-07T03:57:16+00:00Added an answer on June 7, 2026 at 3:57 am

    I found the problem. This line below from the source code was forcing the <select> elements to refresh on load. I just removed it. Now it only refreshes when the user makes a change.

    /* Force updating the children. */
    $(this).trigger("change");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for
This may be an extremely easy question but I can't get my head around
this is a bit of a newbie question but hoping I can get some
Pretty much the same as this question. But I can't seem to get this
Sorry for the double post, I will update this question if I can't get
Referring to this question , how can i get the current page size in
This question has been asked before perhaps multiple times, but I can't get the
This is a noob question, but I can't get Valum's Uploader to work no
This should be a simple question, but I can't get it to work :(
Real noob question no doubt, but I can't get my head around this behaviour.

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.