HTML form confirmation???
#1
I have a HTML form which, when submitted I want a popup to appear saying 'Are you sure you wish to submit?', with yes and no options. The yes will contnue submitting the form, and the no will do nothing at all but close the popup.
Bear in mind i'm not a programmer
Bear in mind i'm not a programmer
#2
Give this a try - you can't have yes / no unless you use VBscript, then it wont work in Netscape etc. You can have OK / Cancel option though:
Add this javascript to your page:
<script language="JavaScript">
<!--
function submitForm(formName) {
if(confirm("Are you sure you wish to submit?")) {
document.forms[formName].submit();
}
}
//-->
</script>
Then your submit button for your form would be:
<input type="button" name="submitButton" value="Submit" onclick="javascript:submitForm('myForm')">
Change myForm to the name of your form, and make sure the button type is "button" and not "submit"
Add this javascript to your page:
<script language="JavaScript">
<!--
function submitForm(formName) {
if(confirm("Are you sure you wish to submit?")) {
document.forms[formName].submit();
}
}
//-->
</script>
Then your submit button for your form would be:
<input type="button" name="submitButton" value="Submit" onclick="javascript:submitForm('myForm')">
Change myForm to the name of your form, and make sure the button type is "button" and not "submit"
#4
everything works except when you actually click OK, the form doesn't submit. Nothing happens.
The VBScript version would be better as we only use IE. Could you convert the code??
Cheeky - i'm sorry.
The VBScript version would be better as we only use IE. Could you convert the code??
Cheeky - i'm sorry.
#5
<html>
<head>
</head>
<body>
<form method="GET" action="rusure.htm" onsubmit="return checkForm()">
Your name : <input type="text" name="myname" />
<br>
<input type="submit" value="Submit Form" />
</form>
<script language="VBScript">
function checkForm()
if msgbox("Are you sure you wish to submit?",vbYesNo,"Submit Form?") = vbYes then
checkForm=true
else
checkForm=false
end if
end function
</script>
</body>
</html>
[Edited by SCOSaltire - 1/24/2003 9:16:35 PM]
[Edited by SCOSaltire - 1/24/2003 9:26:49 PM]
<head>
</head>
<body>
<form method="GET" action="rusure.htm" onsubmit="return checkForm()">
Your name : <input type="text" name="myname" />
<br>
<input type="submit" value="Submit Form" />
</form>
<script language="VBScript">
function checkForm()
if msgbox("Are you sure you wish to submit?",vbYesNo,"Submit Form?") = vbYes then
checkForm=true
else
checkForm=false
end if
end function
</script>
</body>
</html>
[Edited by SCOSaltire - 1/24/2003 9:16:35 PM]
[Edited by SCOSaltire - 1/24/2003 9:26:49 PM]
Thread
Thread Starter
Forum
Replies
Last Post
shorty87
Full Cars Breaking For Spares
19
22 December 2015 11:59 AM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM
shorty87
Wheels And Tyres For Sale
0
29 September 2015 02:18 PM