Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-08-2005, 07:04 AM   PM User | #1
idobson
New Coder

 
Join Date: May 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
idobson is an unknown quantity at this point
Dynamic List won't remember last setting.

Ok, what I've got is 2 boxes on the screen, and depending on what you choose in box 1 it populates the list in warranty_itemclss with the correct options for that class.
Problem is, next time I go back to that record and pull it up, as soon as I go to edit the record it clears the value for warranty_itemclss and if you click save the record is saved without the value that the record previously had.

What am I doing wrong? I posted the code below.



function ClearOptions(OptionList) {
// Always clear an option list from the last entry to the first
for (x = OptionList.length; x >= 0; x = x - 1) {
OptionList[x] = null;
}
}

if (this.value=='AV')
{
// Clear out the list
ClearOptions(warranty_itemclss);
// fill the list
warranty_itemclss.options.add(new Option('Television', 'Television'));
warranty_itemclss.options.add(new Option('Big Screen Television', 'Big Screen Television'));
warranty_itemclss.options.add(new Option('VHS Recorders', 'VHS Recorders'));
}
if (this.value=='CO')
{
// Clear out the list
ClearOptions(warranty_itemclss);
// fill the list
warranty_itemclss.options.add(new Option('CPU', 'CPU'));
warranty_itemclss.options.add(new Option('Monitor', 'Monitor'));
warranty_itemclss.options.add(new Option('Printer', 'Printer'));
}
if (this.value=='GM')
{
// Clear out the list
ClearOptions(warranty_itemclss);
// fill the list
warranty_itemclss.options.add(new Option('Toaster', 'Toaster'));
warranty_itemclss.options.add(new Option('Kitchen Centres', 'Kitchen Centres'));
warranty_itemclss.options.add(new Option('Vacuum Cleaners', 'Vacuum Cleaners'));
}
if (this.value=='PE')
{
// Clear out the list
ClearOptions(warranty_itemclss);
// fill the list
warranty_itemclss.options.add(new Option('Digital Camera', 'Digital Camera'));
warranty_itemclss.options.add(new Option('Film Camera', 'Film Camera'));
warranty_itemclss.options.add(new Option('Camcorder', 'Camcorder'));
}
idobson is offline   Reply With Quote
Old 05-08-2005, 03:47 PM   PM User | #2
shnplr
New Coder

 
Join Date: May 2005
Location: Sydney, Aust
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
shnplr is an unknown quantity at this point
for (x = OptionList.length - 1; x >= 0; x--) {
shnplr is offline   Reply With Quote
Old 05-09-2005, 05:44 AM   PM User | #3
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Or you can just set the option length to 0.

OptionList.length = 0;
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:47 PM.


Advertisement
Log in to turn off these ads.