If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

document.form doesn't work if there are only some hidden input field in the form

RESOLVED DUPLICATE of bug 178258

Status

()

Core
HTML: Parser
RESOLVED DUPLICATE of bug 178258
16 years ago
14 years ago

People

(Reporter: Pete Zha, Assigned: harishd)

Tracking

({compat, testcase})

Trunk
compat, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

16 years ago
See following(first) attachment.
The first script doesn't work because document.form1 has no property.
But in the second form(form2), only difference with form1 is there are some text
after the hidden input.
Very interesting problem...
But I'm not sure whether this is a known but, just file it as UNCONFIRMED.
Could anyone confirm it or tell me which but it duplicate with?
(Reporter)

Comment 1

16 years ago
Created attachment 88761 [details]
testcase
(Reporter)

Updated

16 years ago
Summary: document.form doesn't work if only hidden input in the form → document.form doesn't work if there are only some hidden input field in the form

Comment 2

16 years ago
*** Bug 153541 has been marked as a duplicate of this bug. ***

Comment 3

16 years ago
You test case starts with <html></body>
If you correct this with <html><body>, the test case will work corectly.

Comment 4

16 years ago
Created attachment 88763 [details]
Corrected test case
To parser since this looks like a parsing issue
Assignee: rods → harishd
Component: HTML Form Controls → Parser
QA Contact: tpreston → moied

Comment 6

15 years ago
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030110
(Gentoo Build)

Loading latest attachment loads page and triggers 2 popups, saying "msg's value:
test1" and then after hitting ok, "msg's value: test2".  The title bar shows
"[JavaScript Application]".   When the pages loads, it shows "soem text".

This appears to be correct behavior to me, but i'm not quite sure what is
supposed to happen.
The first testcase is the only relevant one; the rearranging of the content
model seems to trip up the form, although I don't quite understand how.
Keywords: compat, testcase

Comment 8

15 years ago
I see this, WinXP 2003012908.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 9

15 years ago
My problem may be related to this bug?
The following code works OK on w98 IE6 but does not work on mozilla1.3a or 1.3b
sparc linux build from source. 

You can not visit the site as it is secured at my stockbroker. 
IE6 takes me to the new site, mozilla just times out. 
I dont know if this is a bug or is it javascript error?

this is called by a button using RedirectResearch('home','')
the status bar shows Connecting to www.shareanalysis.com...
the error dialog Alert says "The document contains no data."
here is the javascript:

function cookieVal (cookieName)
{
        thisCookie = document.cookie.split("; ");
        for (i=0; i<thisCookie.length;  i++)
        {
                if (cookieName == thisCookie[i].split("=")[0])
                {
                        return thisCookie[i].split("=")[1]
                }
        }
        return 0
}

function RedirectResearch(pagename, seccode)
{
        document.form1.UserId.value = cookieVal("ID");
	document.form1.Page.value = pagename;
        document.form1.SecId.value = seccode;
        document.form1.action =
"https://www.shareanalysis.com/Quicktrade/Entry.asp";
        document.form1.method = "post";
        document.form1.submit();
}
=================
here is how the button was made:
new
navElement('javascript:RedirectResearch(\'home\',\'\')','/images/nav/btn_research','Research'),
==============
here is how form1 is made
<form name="form1">
   <input type="hidden" name="UserId" value="">
   <input type="hidden" name="Page" value="">
   <input type="hidden" name="SecId" value="">
</form>

=============
cookie manager shows for cookie 'ID"
informationis  1802016123
server secure is yes
It looks like the parser has explicit code to handle the following case:

  If we have not seen a <body> tag and we see a <script> tag, move that <script>
  tag over under the <head> tag.

In the process, the <script> is actually appended to the document _before_ the
<form> is, which causes all sorts of fun stuff to happen.  See
CNavDTD::HandleStartToken

I suspect that code is there for a reason, and that removing or changing it
should not be undertaken lightly...

*** This bug has been marked as a duplicate of 178258 ***
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.