Popup Confirms Form Submit

[Total: 0    Average: 0/5]

This example shows how to have a form reconstructed in a popup window.

Body Code:

<form name=f1 onsubmit="return validateIt(document.f1);">
<input type=text name="faction" value="http://www.js-x.com/">
<input type=text name="fmethod" value="get">
<input name=t1 value="one">
<input name=t2 value="two">
<input type=submit value="Go">
</form>

<script>
var _st="";

var _win=null;
function validateIt(_f)
{
_st="";
_st+="<html><head><title>Verify Form</title></head>";
_st+="<body>";
_st+="<form action='";
_st+=_f.faction.value;
_st+="' method='";
_st+=_f.fmethod.value;
_st+="'>";
_st+="<input name=t1 value='"+_f.t1.value+"'>";
_st+="<input name=t2 value='"+_f.t2.value+"'>";
_st+="<input type=button value='Cancel' onclick='self.close()'>";
_st+="<input type=submit value='Submit'>";

	  _win=window.open();
	  /* wait 1 second then write output */
	  setTimeout("_win.document.open();_win.document.write(_st);_win.document.close();",1000);

  /*
   * do not submit this form.
   */
  return false;
}
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *