C
Chris
Hi,
i want to validate a textbox like this:
<asp:TextBox ID="vrg" runat="server" Width="495px" TextMode=MultiLine/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="vrg"
Text="*" />
<asp:Button ID="Button1" runat="server" Text="go" />
This works: validation occurs on client side (no postback).
Now i want to perform some other checks with Javascript, so o added a
clientonclick like this:
<asp:Button ID="Button1" runat="server" OnClientClick="return test()"
Text="go" />
Whatever the code of function test() contains (actually it contains some
check on other texbox and also "return false", but can even be empty), from
now when clicking on the button, the validation still occurs but each time
with a postback (i checked with Page.IsPostabck).
I even tried with property Enable Client script=true (which is the default
value).
Why does that happen and how to prevent postback without removing the
javascript?
Thanks
Chris
i want to validate a textbox like this:
<asp:TextBox ID="vrg" runat="server" Width="495px" TextMode=MultiLine/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="vrg"
Text="*" />
<asp:Button ID="Button1" runat="server" Text="go" />
This works: validation occurs on client side (no postback).
Now i want to perform some other checks with Javascript, so o added a
clientonclick like this:
<asp:Button ID="Button1" runat="server" OnClientClick="return test()"
Text="go" />
Whatever the code of function test() contains (actually it contains some
check on other texbox and also "return false", but can even be empty), from
now when clicking on the button, the validation still occurs but each time
with a postback (i checked with Page.IsPostabck).
I even tried with property Enable Client script=true (which is the default
value).
Why does that happen and how to prevent postback without removing the
javascript?
Thanks
Chris