Wrox Programmer Forums
|
User Groups - Other Developer User Groups Post your announcements about user groups for developer audiences other than INETA and LUGs
Welcome to the p2p.wrox.com Forums.

You are currently viewing the User Groups - Other Developer User Groups section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 20th, 2006, 02:51 AM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to okJazz
Default Problem with dropdown list

Hi,

I wonder if anyone can help me?

I added an option to my dropdown list and set it as the default option using the Options Constructor as depicted below. The problem is that when the page reloads the default option is always the selected one even when the user has selected a different item. Please how can I make the dropdown forget the default option and select what the user has selected? Any help will be much appreciated.


<body onload="updateDropList()">
 <form name="form1">

   <select name="colour" onchange=updateDropList()>
    'populate this dropdown with values from database
   </select>

 </form>
</body>

function updateDropList()
  {
     var select = document.form1.size;
     var code = select.options[select.selectedIndex].value

     //add the 'all' option and make it the default
     var default_option = new Option ("all","-1",true,true);
     for (i=0; i < products[code].length; i++)
     {
        // populate a second dropdown with values from the database
     }
     // Display the new option in the store_stock Select element
     document.form1.options[products[code].length] = default_option;
  }






Similar Threads
Thread Thread Starter Forum Replies Last Post
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
Problem in dropdown list ankur_bhargava2000 ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2005 09:29 AM
problem with dropdown list in datagrid marty_nguyen Classic ASP Databases 1 May 22nd, 2005 06:16 PM
The problem with pop-up menu and dropdown list williamwang ASP.NET 1.0 and 1.1 Basics 1 April 14th, 2004 02:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.