Closed Bug 68666 Opened 24 years ago Closed 24 years ago

document.someForm.submit() does not work properly

Categories

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

defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 44536

People

(Reporter: adamlock, Assigned: pollmann)

Details

Mozilla does not handle form submits done via Javascript correctly. If the form 
is a POST operation, javascript:document.someForm.submit() will performs two 
submits, the first correctly does a POST with the proper the postdata but the 
channel is thrown away, the second submit is performed as a GET with no postdata 
and this channel is what gets shown on the screen.

This problem is similar to bug 41241 where form submits to a "_blank" target 
window exhibited similar problems.

An HTML sample:

[The file enter.htm]:
<html>
<head>
<TITLE>APCIS2000: Entrance</TITLE></head>
<body BGCOLOR="#000066" BACKGROUND="/apcis/imgs/bkgrMainMenu.gif">
<TABLE><TR><TD width=750>
<nobr>
<table BORDER="0" WIDTH="100%">
  <tr>
    <td COLSPAN="3"align="center"><font SIZE="-2" FACE="Arial" COLOR="#FFCCCC">
                The Entrance page
        </font> </td>
  </tr>
  <tr>
    <td><img SRC="/apcis/imgs/Globe.gif" WIDTH="113" HEIGHT="105" 
ALIGN="bottom"></td>
    <td></td>
    <td><p ALIGN="right"><font SIZE="+2" 
COLOR="#000066"><b><i>APCIS2000&nbsp;&nbsp;</i></b></font></td>
  </tr>
  <tr>
    <td COLSPAN="3"><p align="center"><font SIZE="+2" COLOR="#FF9999">
                Asia - Pacific<br>
                Computerized Information System<br>
                on Port State Control<BR>
    </font></td>
  </tr>
</table>
<NOSCRIPT>
<table BORDER="0" BGCOLOR="#000066" CELLSPACING="12" CELLPADDING="10" 
WIDTH="100%">
  <tr><td align="center"><b><font SIZE="+2" COLOR="#ED4E56">
        Warning! JavaScript is disabled.<br>
    <i>APCIS2000</i> requires JavaScript for its operations.<br>
    Please, <a HREF="jsenabling.htm"><font COLOR="#9999FF">enable 
JavaScript</font></a> in your browser and reload this page.
  </font></b></td></tr>
</table>
</NOSCRIPT>
<form ACTION="/apcis/FMPro" METHOD="post" name="RegForm">
  <input type="hidden" name="-DB" value="Access.fp3">
  <input type="hidden" name="-Lay" value="web">
  <input type="hidden" name="-Format" value="preload.htm">
  <input type="hidden" name="-Error" value="oops.htm">
  <input type="hidden" name="UserIP" value="192.168.0.101">
  <input type="hidden" name="UserName" value="testUser">
  <input type="hidden" name="Key" value="33469064753">
  <input type="hidden" name="-New" value="">
</form>
<DIV ALIGN="CENTER"><BR><BR>
   <A HREF="javascript:document.RegForm.submit()" >ENTER</A>
<BR><BR></DIV>
<table BORDER="0" BGCOLOR="#000066" CELLSPACING="0" CELLPADDING="2" WIDTH="100%"
BACKGROUND="/apcis/imgs/tblbkgrMainMenu.gif">
  <tr>
    <td>
            <p ALIGN="right"><b> <a HREF="mailto:support@apcis.tmou.org"><font 
SIZE="-1" FACE="Arial" COLOR="#000066">mail
              to tech support</font></a><font SIZE="-1" FACE="Arial" 
COLOR="#000066">&nbsp;&nbsp;
              </font></b>
          </td>
  </tr>
</table>
<BR>
<table BORDER="0" ALIGN="CENTER">
  <tr>
    <td ALIGN="center"><font COLOR="#FF9999" FACE="Arial">Optimized for screen 
resolution = 800x600</font></td>
  </tr>
</table>
</nobr>
</TD></TR></TABLE>
</body>
</html>
--------------------------

[Exact HTTP headers]:

{First Request}:
POST /apcis/FMPro HTTP/1.1
Referer: 
http://127.0.0.1:8000/apcis/FMPro?-db=access.fp3&-lay=web&-format=enter.htm&-tok
en=FrVTqX126zCwHsz&-view
Host: 127.0.0.1:8000
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20010104
Accept: */*
Accept-Language: ru,en
Accept-Encoding: gzip,deflate,compress,identity
Keep-Alive: 300
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
Content-Length: 129

-DB=Access.fp3&-Lay=web&-Format=preload.htm&-Error=oops.htm&UserIP=%25UserIP%25&
UserName=%25UserName%25&Key=FrVTqX126zCwHsz&-New=

{Response}
HTTP/1.0 401
Server: FileMakerPro/4.0
WWW-Authenticate: Basic realm="Database access.fp3"
Content-type: text/html

{Second request}
GET /apcis/FMPro HTTP/1.1
Authorization: Basic dGVzdHVzZXI6dGVzdA==
Host: 127.0.0.1:8000
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20010104
Accept: */*
Accept-Language: ru,en
Accept-Encoding: gzip,deflate,compress,identity
Keep-Alive: 300
Connection: keep-alive

{Response}
HTTP/1.0 200 OK
Server: FileMakerPro/4.0
MIME-Version: 1.0
Content-type: text/html

<HTML><HEAD>
   <TITLE>Unexpected Error</TITLE>
<BODY>
 <H1>Unexpected Error: No arguments passed!</H1>
</BODY>
</HTML> 
-------------------------------------------------
Note that both Netscape 4.xx, and MSIE 5 have no such a problem.
Could this be related to bug 68321 ?
Is bug 63732 related to this one?
reassigning
Assignee: rods → pollmann
POST also turns into a GET when the resource requires authentication.  When
snooping the traffic, I see the initial POST, a 401 response, and then a GET
request to the same resource with authentication credentials header set but no
post body.

This is true for both doc.submit() javascript and regular input type="submit"
button.

Tested with Mozilla 0.6 and 0.7 on Linux.
OK, so let's mark this as All/All, and raise the severity to major.
I could not view the school cancellation information owing to this.
Some sites simply do not work.
Severity: normal → major
OS: Windows 2000 → All
Hardware: PC → All
This is a dup of an older bug 44536.  I agree, it's a serious problem.  Over to
the networking team...

*** This bug has been marked as a duplicate of 44536 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Verified dup.
Status: RESOLVED → VERIFIED
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.