Closed Bug 148885 Opened 22 years ago Closed 22 years ago

form submit() function doesn't work

Categories

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

x86
Windows 2000
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 148725

People

(Reporter: huhe, Assigned: jst)

Details

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
BuildID:    Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) 
Gecko/20020508 Netscape6/6.2.3

load the html file below in netscape 6.2.3, then click on the link "submit", it 
doesn't work. When "submit" is clicked, it goes to a javascript function, then 
calls form's submit() eventually. The same html file works on netscape 4.7x and 
IE 5.5/6.0.

Reproducible: Always
Steps to Reproduce:
1.open the html file which I attach in "Additional Information" section.
2.click on the link "submit"
3.submit doesn't send the request to the server, instead it will hang.

Actual Results:  submit doesn't send the request to the server, instead it will 
hang.

Expected Results:  www.netscape.com should be loaded.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">

<form name="form1" method="post" action="http://www.netscape.com">
  <input type="text" name="textfield">
  <input type="hidden" name="hidden_name" value="">
  <a href="javascript:void(dataTypeCompFormSubmit
('submit', 'submit'));">Submit</a>

  <script language="JavaScript" type="text/javascript">
    function dataTypeCompFormSubmit(buttonName, buttonValue) {
      document.form1.hidden_name.value = buttonName;
      document.form1.hidden_name.name  = buttonValue;
      document.form1.submit();
    }
  </script>
</form>

</body>
</html>
Reporter, this is not a form submission bug.  There is an error on the
javascript console when I click the link:
Error: document.form1.submit is not a function
Source File: file:///C:/Dave/FormSubmit.html
Line: 17 [i.e., document.form1.submit();]
It is interesting to note that everything works fine when I remove the lines:
      document.form1.hidden_name.value = buttonName;
      document.form1.hidden_name.name  = buttonValue;
from the script.  Still working on why...
(Win 98 daily build 2002060108)
I have narrowed it down even further.  Just removing the line:
      document.form1.hidden_name.name  = buttonValue;
fixes things also.
So somehow the fact that you are changing the name of a control messes things up
destroying some properties/functions of the form1 object.  Any way you cut it,
it makes all the object's functions inaccessible.
Maybe invalid, probably should reassign to the javascript engine component or
something to get the right answer/QA.
------- Additional Comments From shep@bigredmail.com  2002-06-03 17:58 -------
I have narrowed it down even further.  Just removing the line:
      document.form1.hidden_name.name  = buttonValue;
fixes things also.
So somehow the fact that you are changing the name of a control messes things up
destroying some properties/functions of the form1 object.  Any way you cut it,
it makes all the object's functions inaccessible.
Maybe invalid, probably should reassign to the javascript engine component or
something to get the right answer/QA. 
Assignee: alexsavulov → rogerl
Component: Form Submission → JavaScript Engine
QA Contact: vladimire → pschwartau
This bug has been reported a lot lately; reassigning to DOM Level 0 -
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → desale
The key point is the button's name is being changed to 'submit'.
That particular name conflicts with the form's submit() method.

This bug is a duplicate of bug 148725. Huan, thank you for this report;
you will be cc'ed on the other bug so you may follow its progress -

*** This bug has been marked as a duplicate of 148725 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.