View Full Version : form actions

05-06-2004, 01:19 AM
hello i have written a form with the action as a javascript see below
but what i need to do is when the form is submitted i need the page with the form to stay exactaly as it is and not change when i click on the submit button can someonr help me please


<form method="post" action="javascript:window.open('postinfo.php', 'helpwindow', config='height=300, width=600,
toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no,
directories=no, status=no')">

05-06-2004, 03:33 AM
i found the solution:
function createTarget(){
var fn = document.sampleform.name.value;
var fgn = document.sampleform.gamename.value;
var mail = document.sampleform.email.value;
var y = document.sampleform.why.value;
var msn = document.sampleform.msn.value;
var loc = document.sampleform.location.value;
var saber = document.sampleform.saber.value;
var age = document.sampleform.formage.value;
var add = document.sampleform.addinf.value;
var place = "postinfo.php?name="+fn+"&gamename="+fgn+"&email="+mail+"&why="+y+"&msn="+msn+"&location="+loc+"&saber="+saber+"&formage="+age+"&addinf="+add+"";
window.open(place, 'target', 'height=300', 'width=600', 'toolbar=no', 'menubar=no', 'scrollbars=yes', 'resizable=no', 'location=no', 'directories=no', 'status=no');
return true;

<form name="sampleform">
inputs an stuff
<input type=submit value="Submit to RK" onclick="return createTarget()">

but i had to make it so that when the page refreshed the details of the form were carried over by a syntax

05-06-2004, 04:34 AM
This is a much simpler solution. No need to manually post the data.

function createTarget(target){
var w = window.open('', target, 'height=300', 'width=600', 'toolbar=no', 'menubar=no', 'scrollbars=yes', 'resizable=no', 'location=no', 'directories=no', 'status=no');
<form name="sampleform" action="postinfo.php" target="popup" onsubmit="createTarget(this.target)">
inputs and stuff
<input type="submit" value="Submit to RK" />