calling vbscript subroutine on form submit
Guys
I want to call a vbscript sub which asks the user to cofirm something when they hit the form submit button. At the moment, the onclick attribute calls document.frm.submit(); however I want to ask the customer to confirm their action before submitting the document.
I know how to do this in vb but not in javascript. I'd prefer to use vbscript than javascript as I am more familiar with vb but I don't know how to call the sub from this onclick event.
Any ideas?!
Cheers
Peter
Re: calling vbscript subroutine on form submit
Try in the html declaration of your button following thing:
<asp:button id="myID" onClick="call your script" runat="server" />
in the codebehind you have your this document.frm.submit() standing. Normaly first the script will be called and then your code-behind.
I'm not 100% sure but I've done this in my website and it is working fine
Re: calling vbscript subroutine on form submit
Hi,
do this...
<script language="Javascript">
function submitbutton() {
if (confirm("are you sure")) = "true" then
document.frm.submit()
end if
}
</script>
The for is to have no submit button, jsut a hidden button with a name and value then
<%
if request("hiddenname") <> "" then
do something
end if
%>
try that, and happy days..
ta
kai :wave:
Re: calling vbscript subroutine on form submit
Quote:
Originally Posted by spyatnoon
Try in the html declaration of your button following thing:
<asp:button id="myID" onClick="call your script" runat="server" />
in the codebehind you have your this document.frm.submit() standing. Normaly first the script will be called and then your code-behind.
I'm not 100% sure but I've done this in my website and it is working fine
I'm not using asp.net.......
Re: calling vbscript subroutine on form submit [resolved]
Quote:
Originally Posted by kaihirst
Hi,
do this...
<script language="Javascript">
function submitbutton() {
if (confirm("are you sure")) = "true" then
document.frm.submit()
end if
}
</script>
The for is to have no submit button, jsut a hidden button with a name and value then
<%
if request("hiddenname") <> "" then
do something
end if
%>
try that, and happy days..
ta
kai :wave:
Sorry, been away sunning myself in the Costa Blanca....
Currently have this:
HTML Code:
function confirmSubmit()
{
var agree = confirm("Are you sure you wish to continue?");
if (agree)
document.frm.submit();
//return true;
else
return false;
}
I'm calling this from an a href tag:
HTML Code:
<a href='#' onclick='return confirmSubmit()'>Proceed</a>
with the form header:
HTML Code:
<form name="frm" method="post" action="process.asp">
Seems to work ok now, thanks.