Set selected value in Drop Down

Posted on 2014-10-15
Last Modified: 2014-10-20
I have inherited a classic asp website and I am having some trouble with 1 particular section of it.

There is a drop down list with 3 shipping options in it. The 1st item in the list is "Please Select". This 1st option is set as "selected".

When the use enters their Zip Code, it runs a prototype ajax updater routine that reloads the shipping options in the drop down.

After it loads the options, it is selecting the last option in the list instead of the 1st option of "Please Select".

When you look at the html code, it sill shows that the 1st option is "selected". So, I assume that the last option is being selected via javascript as part of the ajax routine and exists in RAM instead of written html.

How in the world do I troubleshoot this and where do I look to see how the selected item is being selected?

Any guidance is appreciated!
Question by:GenesisTech
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
LVL 82

Expert Comment

ID: 40383266
post the code or BETTER a link to your page

Author Comment

ID: 40383293
Leakim- What code are you interested in seeing? The ajax call?

Author Comment

ID: 40383294
function updateshipzipcodecountryajax(form) {
   document.getElementById("selresultlist").innerHTML="<img src='images/ajaxshippingload.gif' border='0'> checking availability...";
   document.getElementById('Action').disabled = true;
   var checkingurl="dnswajaxshippingzipcodecountry.asp";
   var pars = 'zipcode=' + form.shipzip.value + '&country=' + form.shipcountry.value +'';
   var url = checkingurl + '?' + pars;
   var target = 'selresultlist';
   var myAjax = new Ajax.Updater(target, checkingurl, {method: 'post',parameters: pars});
   document.getElementById('Action').disabled = false;
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 40383295
The resulting page looks like this but the last Option winds up being selected.

<div name='selresultlist' id="selresultlist">
<select size=1 name="shipmethodType" onchange="shippingCheck(this)">            

<option value="" selected>Select</option>

<option value="U.S. Standard (Typically 2-3 Days) [$7.90]">U.S. Standard (Typically 2-3 Days) [$7.90</option>
<option value="U.S. Expedited (Typically Next Day) [$25.00]">U.S. Expedited (Typically Next Day) [$25.00</option>
<option value="Pick Up [$0.00]">Pick Up [$0.00]</option>

Accepted Solution

GenesisTech earned 0 total points
ID: 40383364
Please close and delete this question - I figured out the problem.

Thank you!

Author Closing Comment

ID: 40391540
Please close and delete this question - I figured out the problem.

Thank you!

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tools for analysis of code 4 49
JavaScript code not working 3 33
Jquery if else not working ... WHY? 5 26
How to hide contact form only if no validation errors 4 28
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question