JS error: form object with multiple names has no properties




DOM: Core & HTML
16 years ago
10 years ago


(Reporter: Michael P. Webb, Assigned: jst)



Firefox Tracking Flags

(Not tracked)




(1 attachment)



16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.6) Gecko/20011120
BuildID:    2001112020

There is a form that has objects with the same name on it. When submitting, I do
a check to see if an object has been changed from its original value. If it has
not been changed, then I change the name of the ojbect so the value will not be
saved on our server.

The problem that I've noticed is if the value of the last form object with the
same name (i.e. the last one of the array) is blank, then a JavaScript error
gets raised:

Error: theForm.hiddenData[count] has no properties
Source File: file:///Xerox/Users/mwebb/Documents/proofs/netscape6bug.html
Line: 55

I have an attachment that will show the error every time.

Reproducible: Always
Steps to Reproduce:
1. Open the attachment in Mozilla
2. fill in some text in the field labeled "0 = "
3. hit the "Continue" button

(the same thing will happen if both fields are filled in with some text)

Actual Results:  2 alert messages should come up:
    WORKING ON = 0
    WORKING ON = 1

Then the error comes up in the JavaScript Console window.

Expected Results:  3 alert message should come up (in this example). In actual
code, the form should just be submitted.

The third alert message should say "Done!".

(To see the page work successfully, enter a value in the field labled "1 =" only.)

I've seen this behavior both on MacOS X and Windows NT.

Comment 1

16 years ago
Created attachment 61494 [details]
Code showing bug

Comment 2

16 years ago
Error: theForm.hiddenData[FIRST_TEST_FIELD] has no properties
Source File: http://bugzilla.mozilla.org/attachment.cgi?id=61494&action=view
Line: 30

looks more like DOM Core
-> reassigning
Assignee: alexsavulov → jst
Component: Form Submission → DOM Core
QA Contact: vladimire → stummala

Comment 3

16 years ago
The problem is in your code, you have two inputs named hiddenData, in the last
loop in your DoAssignments() method you get the first hiddenData input, change
it's name, and then you try to get the second hiddenData input, but at that
point there's only one hiddenData input since you renamed the other one. If this
works in other browsers, it's a bug in those browsers. Fix your code to expect
the logical and your page will work.
Last Resolved: 16 years ago
Resolution: --- → INVALID

Comment 4

16 years ago
verified as invalid


10 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.