PDA

View Full Version : Form posting


uleddie
02-10-2003, 09:09 PM
Java Script Newbie here.

Here's my question everyone.

I have a form which I would like to submit to a certain page if the user pushes the Edit button and if the user pushes the Delete button I need an alert box giving the user a message bout what happens if he deletes the record and if he pushes OK submit the form to another page and if he pushes cancel then do nothing.

I hope I have been clear enough about what i am trying to accomplish and TIA

arnyinc
02-10-2003, 09:36 PM
This won't work in older browsers, but I don't really care about them anyways.


<html>
<head>
<script language="javascript">
function subcheck(myform){
if(confirm('Are you sure you want to delete this?'))
myform.action='second.htm';
else
return false;
}
</script>
</head>
<body>

<form name="theform" action="upgrade_your_browser.htm" method="get">
<input name="one">
<input type="submit" name="submit" value="edit" onClick="this.form.action='first.htm';">
<input type="submit" name="submit" value="delete" onClick="return subcheck(this.form)">
</form>
</body>
</html>

uleddie
02-11-2003, 05:50 PM
Thanks, It works great.