Closed Bug 138410 Opened 22 years ago Closed 22 years ago

Populating select elements dynamically is broken?

Categories

(Core :: Layout: Form Controls, defect)

PowerPC
macOS
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 136885

People

(Reporter: matiasnu, Assigned: john)

Details

Attachments

(2 files)

This code worked in 0.99, but doesn't work in 1.0rc1;


What it does is populate a drop down (<select>) in another frame when i 
click on some checkboxes.

It's on an intranet, so I cant produce a test case right now. If you need one, 
please let me know and I'll try to create one for you.

---

function updateBasketMenu(checkboxObject, contentID, text, basketID) {
	var basketElement = 
parent.frames['options'].document.getElementById(basketID)
	
	if(checkboxObject.checked) {
		with(basketElement) {
			var menulength = length;
			options[menulength]= new Option(text, contentID);
		}
	}
	else {
		for(var i = 0; i< basketElement.length; i++) {
			if(basketElement.options[i].value == contentID) {
				basketElement.options[i] = null;
				break;
			}
		}
	}
	
	var numImages = basketElement.length - 1; // forget the first row
	var numText;
	switch(numImages) {
		case 0:
			numText = 'No images selected';
			break;
		case 1:
			numText = '1 image selected:';
			break;
		default:
			numText = numImages + ' images selected:';
	}
	basketElement.options[0].text = numText;
}

---
Matias: yes, we'll need a testcase, as reduced as possible.
Could you attach one via the "Create a New Attachment" link above?

Also, do you see any errors in the JavaScript Console?
(be sure to clear it of all previous errors first)

For the time being, reassigning to HTMLFrames. This is not likely
to be a JS Engine bug.
Assignee: rogerl → jkeiser
Component: JavaScript Engine → HTMLFrames
QA Contact: pschwartau → amar
Submitted ugly testcase. Upon further inspection, the drop down gets 
populated, but it's visible part doesn't get updated.

OPen up the default.asp.html file.
Click on let's say 3 checkboxes.
The drop down at the bottom still says "No images selected".
Click on the dropdown and you'll see 3 filenames + "3 images selected".
Attachment #80361 - Attachment description: Testcase (a darn ugly one, but hey...) → Zipped Testcase (a darn ugly one, but hey...)
Attachment #80361 - Attachment mime type: application/octet-stream → application/zip
I confirm the testcase behaves as advertised, but it would be better to produce
a *minimized* testcase for the problem, Matias.

Take your tescase and remove everything possible that you can while still
retaining the bug behavior.

Matias, also note that two errors are generated on the JS Console while loading
your testcase: "browser is not defined", and "process_button is not defined".
Attached file New minimized testcase
Ok, is this new testcase minimized enough for you? ;)

Frames are not involved here. So I changed area to Form Controls. RC2 still has
this bug.
Component: HTMLFrames → HTML Form Controls
Yes, that was enough, thanks.  For future reference, please upload testcases 
as HTML, not zip ... remember, the fewer steps required to use the testcase, 
the quicker bugs get confirmed, investigated, fixed.

Turns out this is a duplicate of bug 136885.

*** This bug has been marked as a duplicate of 136885 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Well, I should have tested a trunk build before opening my mouth. It, of 
course, works in the latest trunk.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: