...

View Full Version : form actions



n3misis
05-06-2004, 12: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

code:

<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')">

n3misis
05-06-2004, 02:33 AM
i found the solution:
<script>
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;
}
</script>

<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

glenngv
05-06-2004, 03: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');
w.focus();
}
...
<form name="sampleform" action="postinfo.php" target="popup" onsubmit="createTarget(this.target)">
inputs and stuff
<input type="submit" value="Submit to RK" />
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum