Re: submitting a form through another frame
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: submitting a form through another frame

From: Archimedes Trajano <nospam@devdex.com>
Date: Tue Aug 30 2005 - 00:45:10 CEST

You can try this... It opens up a new window containing the same form,
copy all the data into the new window then click on the submit button.
Afterwards close the window.

At least this method will support users clicking on the back buttons or
bookmarks. You may optimize this to have a flag to check if data was
changed and such.

Following is a code snippet.

<script>
function doSubmit() {
  var submitter = window.open("formsubmit.html");
  submitter.document.getElementById("FOOID").value =
document.getElementById("FOOID").value;
  submitter.document.getElementById("AUTOSAVE").click();
  submitter.close();
}
</script>

<body onunload="doSubmit()">
<form action="http://localhost/" method="get">
        FOO<input type="text" id="FOOID" name="FOO" value="xyz" />
  <input type="Submit" id="AUTOSAVE" name="BAR" value="SUBMIT" />
</form>
</body>
</html>

---
Archimedes Trajano http://www.trajano.net/
*** Sent via Developersdex http://www.developersdex.com ***
Received on Tue Oct 18 03:14:19 2005