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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:57:12+00:00 2026-06-12T07:57:12+00:00

I am updating a multi select box using ajax with prototype: new Ajax.Updater(selectbox, someurl,{

  • 0

I am updating a multi select box using ajax with prototype:

new Ajax.Updater(selectbox, someurl,{
    method:'post',
    parameters: "data=" + result,
    onFailure: function(){ alert('ajax updater error'); }
});

The updater works pretty well and the select box is updated with options returned by the ajax call. The only problem is that the very top option is being automaticly selected in IE.

I was trying to manually deselect it by putting

document.getElementById(selectbox).options[0].selected = false;

right after the Ajax.Updater() function and inside the onSuccess: {} clause but it was initialised before the checkbox was updated so the only way from here was to set a delay but I’m wondering if there’s another way to do this?

Also adding the attribute selected="false" to every option does not solve the problem as then the last option is being selected automaticly 🙁

  • 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-12T07:57:14+00:00Added an answer on June 12, 2026 at 7:57 am

    Add a first field with empty value (or something your program understands as “not a value in the expected domain”) and select it. The HTML select field MUST have a field selected all the time (right?)

    EDIT The w3c specs states that:

    17.6.1 Pre-selected options Zero or more choices may be pre-selected for the user. User agents should determine which choices are
    pre-selected as follows:

    If no OPTION element has the selected attribute set, user agent
    behavior for choosing which option is initially selected is undefined.
    Note. Since existing implementations handle this case differently, the
    current specification differs from RFC 1866 ([RFC1866] section 8.1.3),
    which states: The initial state has the first option selected, unless
    a SELECTED attribute is present on any of the elements. Since
    user agent behavior differs, authors should ensure that each menu
    includes a default pre-selected OPTION.

    If one OPTION element has the selected attribute set, it should be
    pre-selected.
    If the SELECT element has the multiple attribute set
    and more than one OPTION element has the selected attribute set, they
    should all be pre-selected. It is considered an error if more than
    one OPTION element has the selected attribute set and the SELECT
    element does not have the multiple attribute set. User agents may vary
    in how they handle this error, but should not pre-select more than one
    choice.

    So, the behavior must be controlled by the application, as each browser can choose a different one by default. But eventually, one of them will be chosen. Usually , when it has multiple attribute defined, it selects none but… specs state nothing about that, so the empty option could work as well (to be sure).

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

Sidebar

Related Questions

I am using multi-threading to get data, parse it, create objects and store them.
I'm new to Entity Framework. I've created a Multi Tier Application, in MVC, using
When updating a DataTable with 1850-ish new rows to a FbDataAdapter I get a
After updating to Parsec 3.1 from 2.x, code using many1, such as word =
After updating to XCode 4.3, all my archives built using XCode 4.2 are gone.
I'm developing a multi-tier app using EF CF . I managed to delete a
Issue I am working on a multi-executable QT project using qmake in conjunction with
I'm updating queries that were using the old construction for outer joins (=* and
I tried sqlite, by using multi-thread, only one thread can update db at the
There is some discussion on my team about updating entity data and how best

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.