Closed
Bug 98242
Opened 24 years ago
Closed 24 years ago
Drop down onchange seems to only with after an alert call
Categories
(Core :: Layout: Form Controls, defect)
Tracking
()
VERIFIED
WORKSFORME
People
(Reporter: wahle, Assigned: rods)
Details
Attachments
(4 files)
I'm not even sure if this is the right place to put this bug. It's the only
Javascript section that I've seen in Bugzilla. My appologies if this is wrong!
Please let me know! Thank you!
Basically, I have two drop down boxes, which the first drop down changes the
second dropdown options completly and even selects the proper one which should
be selected. It doesn't seem to work unless I put an alert() call in one of the
function calls.
I have not tried the code under windows, only Linux on 0.9.3+
The following code is the broken code:
<SCRIPT LANGUAGE="Javascript">
var interval = new Array();
var discount_interval = new Array();
var discount_id = new Array();
var discount_description = new Array();
function initDiscount ()
{
interval[0] = "1M";
discount_interval[0] = "0";
discount_id[0] = "0";
discount_description[0] = "No Discount";
discount_interval[1] = "0";
discount_id[1] = "49";
discount_description[1] = "a11";
discount_interval[2] = "0";
discount_id[2] = "50";
discount_description[2] = "a12";
interval[1] = "1Y";
discount_interval[3] = "1";
discount_id[3] = "0";
discount_description[3] = "No Discount";
discount_interval[4] = "1";
discount_id[4] = "51";
discount_description[4] = "b11";
discount_interval[5] = "1";
discount_id[5] = "52";
discount_description[5] = "b12";
discount_interval[6] = "1";
discount_id[6] = "53";
discount_description[6] = "b13";
document.serviceform.chargeinterval.options.length = 0;
for (id in interval)
{
var tempOption = new Option;
tempOption.text = interval[id];
tempOption.value = interval[id];
document.serviceform.chargeinterval.options
[document.serviceform.chargeinterval.options.length] = tempOption;
}
}
function selectedMenuInterval ()
{
for (id in interval)
{
if (interval[id] == "1Y") {
document.serviceform.chargeinterval.options[id].selected = true;
//document.serviceform.chargeinterval.onchange();
}
}
}
function selectedMenuDiscount ()
{
var index = 0;
for (id in discount_id)
{
if (interval[discount_interval[id]] == "1Y") {
if (discount_id[id] == 53) {
document.serviceform.discountid.options[index].selected = true;
}
index++;
}
}
}
function updateMenus ()
{
document.serviceform.discountid.options.length = 0;
for (id in discount_interval)
{
//alert(document.serviceform.chargeinterval.selectedIndex);
if (discount_interval[id] == document.serviceform.chargeinterval.selectedIndex)
{
var tempOption = new Option;
tempOption.text = discount_description[id];
tempOption.value = discount_id[id];
document.serviceform.discountid.options
[document.serviceform.discountid.options.length] = tempOption;
}
}
document.serviceform.discountid.options[0].selected = true;
}
</SCRIPT>
Now, if you uncomment the alert() call in the updateMenus function, everything
works fine, except ofcourse that there is an alert box many times which is not
good.
Comment 1•24 years ago
|
||
Browser, not Rhino. Reassigning to HTML Form Controls for further triage -
Assignee: nboyd → rods
Component: Core → HTML Form Controls
Product: Rhino → Browser
QA Contact: pschwartau → madhur
Comment 2•24 years ago
|
||
wahle@innercite.com: could you attach a complete HTML testcase to this bug?
(via the "Create a new attachment" link above). That will help us - we
need the HTML elements as well as the JavaScript - thanks.
Reporter | ||
Comment 3•24 years ago
|
||
Reporter | ||
Comment 4•24 years ago
|
||
The dropdowns in question are the Interval and Discount located at the bottom
of the HTML screen.
Comment 5•24 years ago
|
||
Comment 6•24 years ago
|
||
I see the bug. attaching reduced testcases.
Comment 7•24 years ago
|
||
Comment 8•24 years ago
|
||
Comment 9•24 years ago
|
||
actually, on second thoughts - i do see the onChange event being triggered with
or without the alert box. I prepared the testcase using pieces from the
reporters code. Even the testcase provided by the reporter seems to work on both
linux 7.1 and win32 (branch build from 10/03/01).
Reporter,
I am marking this bug 'works for me'. If you still see the problem, feel free to
reopen the bug.
Thanks!
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•