Closed Bug 153542 Opened 22 years ago Closed 21 years ago

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

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 178258

People

(Reporter: zhayupeng, Assigned: harishd)

References

Details

(Keywords: compat, testcase)

Attachments

(2 files)

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?
Attached file testcase
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
*** Bug 153541 has been marked as a duplicate of this bug. ***
You test case starts with <html></body>
If you correct this with <html><body>, the test case will work corectly.
Attached file Corrected test case
To parser since this looks like a parsing issue
Assignee: rods → harishd
Component: HTML Form Controls → Parser
QA Contact: tpreston → moied
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
I see this, WinXP 2003012908.
Status: UNCONFIRMED → NEW
Ever confirmed: true
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
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: