WEhalt
asked on
Javascript - vb.net ; check for form validation before click event
I have a page that uses vb processes for a cancel and a save button click. Is there a way to make these buttons check with one of the javascript functions before performing their actions?
'On this one I would like to verify with the user whether or not they really wish to proceed if any of the values on the form were changed.
'On this one I would like to run the Business Rule validation before allowing the save
'On this one I would like to verify with the user whether or not they really wish to proceed if any of the values on the form were changed.
Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
BindGrid()
End Sub
'On this one I would like to run the Business Rule validation before allowing the save
Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
SaveDailyClose()
Response.Redirect("Disposal.aspx")
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In the following example, if I add the OnClientClick attribute to the button, will the function btnNext_Click. in VB, never run?
code in object Inbound.aspx
==========================
<script language="javascript" type="text/javascript">
function stopTheButton() {
return false;
}
....
<body>
<form id="form1" runat="server">
<asp:Button ID="btnNext" Runat="server"
OnClientClick="return stopTheButton();"
Text="Save/Next" />
...
vb code in object Inbound.aspx.vb
==========================
Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
SaveDailyClose()
Response.Redirect("EndProd
End Sub