Closed Bug 138767 Opened 23 years ago Closed 23 years ago

Form field content appears to be shifted

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 127847

People

(Reporter: staltari, Assigned: jst)

References

()

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9) Gecko/20020311 BuildID: 2002031104 Form field content appears to be shifted (i.e. content that shold appear in field x is shown in field x+1). "Quando vuoi partire?" [When do you want to go?] fields that should contain a date dd/mm/yyyy and "A che ora?" [What time you want to go?] should contain current time hh:mm, instead date fileds show [empty]/dd/mm and time fields show yyyy:hh. Not sure if really a bug or webmaster fault, however it is shown correctly in IE5. Reproducible: Always Steps to Reproduce: Just load the page. Actual Results: See "Description" Expected Results: See "Description" Plugins : File name: C:\Programmi\mozilla.org\Mozilla\plugins\NPSWF32.dll Shockwave Flash 5.0 r41 application/x-shockwave-flash application/futuresplash
same on Opera.. maybe sucking HTML? or better: does it work anywhere?
Fails in NS4 and IE too. In fact, the designer just doesn't realize that the array is 0-based, not 1-based.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Boris: thanks. Marking Verified; the code at the site does this: document.forms[0].elements[4].value = giorno; document.forms[0].elements[5].value = mese; document.forms[0].elements[6].value = parseInt(anno,10); but if we enter these javascript:URLs at the site, we get this: javascript: alert(document.forms[0].elements[3].name) ---> "datag" javascript: alert(document.forms[0].elements[4].name) ---> "datam" javascript: alert(document.forms[0].elements[5].name) ---> "dataa""
Status: RESOLVED → VERIFIED
On my home PC with IE5 works. The page is taken from italian railways site (yea, you may laugh now ;-) that is used by thousands of people every day. If there were nobody to get it work, it should never published. The main page of the site is http://www.trenitalia.com. The page in the English version of the site works with IE and Mozilla too, but the Italian version works with IE but not in Mozilla (very odd :-)
I reopened the bug just to ensure you know the page works with IE. Probalby it is a badly designed page, but maybe you may evaluate to do an additial check after you read my comment #4.
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---
Alessandro is correct; the given site does work in IE6. Here's why: for both IE and Mozilla, the code does this: document.forms[0].elements[4].value = giorno; document.forms[0].elements[5].value = mese; document.forms[0].elements[6].value = parseInt(anno,10); But if we enter these javascript:URLs at the site, we get this: IN MOZILLA javascript: alert(document.forms[0].elements[0].name) ---> "lang" javascript: alert(document.forms[0].elements[1].name) ---> "stazin" javascript: alert(document.forms[0].elements[2].name) ---> "stazout" javascript: alert(document.forms[0].elements[3].name) ---> "datag" javascript: alert(document.forms[0].elements[4].name) ---> "datam" javascript: alert(document.forms[0].elements[5].name) ---> "dataa" javascript: alert(document.forms[0].elements[6].name) ---> "timsh" IN IE6 javascript: alert(document.forms[0].elements[0].name) ---> "lang" javascript: alert(document.forms[0].elements[1].name) ---> "" javascript: alert(document.forms[0].elements[2].name) ---> "stazin" javascript: alert(document.forms[0].elements[3].name) ---> "stazout" javascript: alert(document.forms[0].elements[4].name) ---> "datag" javascript: alert(document.forms[0].elements[5].name) ---> "datam" javascript: alert(document.forms[0].elements[6].name) ---> "dataa" So in IE, the values |giorno|, |mese|, etc. are assigned to the correct fields, but in Mozilla, they are shifted and off by one index. As Alessandro has suggested, this is bad programming practice: form elements should be identified by their name or id, NOT by their order! The mysterious |elements[1]| in IE6 is an <OBJECT> element for a Shockwave Flash plugin. You can see this by using the following javascript: URL after you load the site in IE6: javascript: alert(document.forms[0].elements[1].outerHTML);
Apparently the order of the form.elements array differs in IE and Mozilla, and the site authors coded this (badly) to work in IE. Reassigning to DOM Level 0 to confirm this - is it true that the order of the form.elements array differs in IE and Mozilla, and there is no W3C contradiction? I believe the answer is "Yes", so this bug should then be reassigned to Tech Evangelism, Western Europe. Also compare bug 127847 at http://www.trenitalia.it
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Phil, thanks. This is a dup. Follow-up comments and minimal testcase on the other bug... *** This bug has been marked as a duplicate of 127847 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → DUPLICATE
Verified Duplicate. Alessandro, thank you for this report; you have been cc'ed on the duplicate bug -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.