Open Bug 364382 Opened 19 years ago Updated 3 years ago

Form fields cleared by page reload after using DOM to create a 2nd form

Categories

(Core :: Layout: Form Controls, defect)

1.8 Branch
x86
Windows XP
defect

Tracking

()

People

(Reporter: kday, Unassigned)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8 1. Load the page below 2. Enter text in the field 3. Refresh the page -- text remains (as it should) 4. Click the link "Create a form by DOM operations" -- creates a new form (all names/id's are unique) 5. Refresh again -- the text entered previously is gone HTML file to repro follows <html> <head> <title>FireFox looses form contents on dynamic form creation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> function createForm() { elemCreateFormHere = document.getElementById("createFormHere"); elemCreateFormHere.innerHTML = "\ <form action='/' method='post' name='t-search-added' style='background-color: #ccc; padding: 5px'> \n\ Simple form inserted by DOM operations. <br/>\n\ <input type='text' name='textfield2'> \n\ </form> \n\ "; } function createParagraph() { elemCreateFormHere = document.getElementById("createFormHere"); elemCreateFormHere.innerHTML = "\ <p>In contrast, this is just a paragraph -- Creating it doesn't cause the form to be cleared on refresh.</p> \n\ "; } </script> </head> <body> <h3>FireFox looses form history on dynamic form creation</h3> <p>Steps:</p> <ol> <li>Load this page in FireFox. </li> <li>Enter some text in the &quot;Simple Form&quot; below.</li> <li>Refresh the page; notice that the text you just entered remains. </li> <li>Click on this link: <a href="#" onClick="javascript:createForm();return false;">Create a form by DOM operations</a>. As you might expect, this will create a trivial form. It inserts it in the grey area below.</li> <li> Refresh the page; notice that the text you previously entered has been erased.</li> </ol> <p>That's a bug, right?</p> <p>In contrast, <a href="#" onClick="javascript:createParagraph();return false;">this link</a> creates a simple paragraph. The form contents remain after a page reload. </p> <blockquote id="createFormHere"> <span style='background-color:#ccc'> (Clicking on the link in Step 4 above will insert a form here.) </span> </blockquote> <form name="form1" method="post" action="/nowhere.cgi" style="background-color: #ccc; padding: 5px"> Simple form<br/> <input type="text" name="textfield"/> </form> </body> </html> Reproducible: Always Steps to Reproduce: See details Actual Results: Form fields cleared by page refresh Expected Results: Any structural changes in the page should be lost, returning the page to its initial state. Forms & form fields which were not altered by DOM operations should retain their contents. Default theme ... reproduced by a couple of other developers here at Amazon, and on Linux 1.5.0.8 (Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8), so it's unlikely to be a machine configuration issue.
Same as the html file included in the bug details.
Probably closely related to 311507
Component: Form Manager → History: Session
Product: Firefox → Core
QA Contact: form.manager → history.session
Version: unspecified → 1.8 Branch
Component: History: Session → Layout: Form Controls
QA Contact: history.session → layout.form-controls
Yeah. The issue is that the index of the form, not the name/id, is used for restoration.
Depends on: 311507
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → mozilla2.0
Target Milestone: mozilla2.0 → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: