C
CGuy
Hi,
I have the following code in my aspx page
<form id="Form1" method="post" runat="server">
<asp:TextBox ID="txtTest" Runat="server" />
<asp:RequiredFieldValidator ID="valText" ControlToValidate="txtTest"
Runat="server" Text="*" Display="Dynamic" ErrorMessage="Enter Value" />
<asp:ValidationSummary DisplayMode="BulletList" Runat="server"/>
<asp:Button Text="Submit" ID="Submit" Runat="server"/>
</form>
<script language="javascript">
<!--
function ValidateForm(targetForm)
{
return(confirm('Are you sure?'));
}
-->
</script>
In the code behind fiel for the aspx page, i have the following code (to
invoke the "ValidateForm" javascript function when the button is clicked)
this.Submit.Attrbutes.Add("onclick", "javascript:return
ValidateForm(this.form);");
I have NOT turned off client side validation / scripting.
Now, when I run the page and click on the submit button, the
ValidationSummary control is updated only after the form is posted to the
server - it does not happen at the client side (I can see the form is
posted). But, if i remove the javascript funtion call from the Submit button
(by removing the "this.Submit.Attrbutes.Add.." call from the code behind
file, the ValidationSummary control gets updated without making a trip to
the server.
How do I make the ValidationSummary control display the error message(s)
without making a trip to the server when the button has a javascript
function tied to it's client side onclick event handler? Any help will be
greatly appreciated.
CGUY
I have the following code in my aspx page
<form id="Form1" method="post" runat="server">
<asp:TextBox ID="txtTest" Runat="server" />
<asp:RequiredFieldValidator ID="valText" ControlToValidate="txtTest"
Runat="server" Text="*" Display="Dynamic" ErrorMessage="Enter Value" />
<asp:ValidationSummary DisplayMode="BulletList" Runat="server"/>
<asp:Button Text="Submit" ID="Submit" Runat="server"/>
</form>
<script language="javascript">
<!--
function ValidateForm(targetForm)
{
return(confirm('Are you sure?'));
}
-->
</script>
In the code behind fiel for the aspx page, i have the following code (to
invoke the "ValidateForm" javascript function when the button is clicked)
this.Submit.Attrbutes.Add("onclick", "javascript:return
ValidateForm(this.form);");
I have NOT turned off client side validation / scripting.
Now, when I run the page and click on the submit button, the
ValidationSummary control is updated only after the form is posted to the
server - it does not happen at the client side (I can see the form is
posted). But, if i remove the javascript funtion call from the Submit button
(by removing the "this.Submit.Attrbutes.Add.." call from the code behind
file, the ValidationSummary control gets updated without making a trip to
the server.
How do I make the ValidationSummary control display the error message(s)
without making a trip to the server when the button has a javascript
function tied to it's client side onclick event handler? Any help will be
greatly appreciated.
CGUY