Feb 3, 2010

9:58 PM - , No comments

Validate with OnClientClick

Using an OnClientClick function in submit button like:

<asp:Button ID="btnFinish" runat="server" SkinID="ButtonWidth50" Text="Finish" OnClientClick="return CheckForm()"/>

maybe lets your validate controls do not work correctly.

When the CheckForm() returns a true value, your page goes thought to sever and does not execute validate functions.

Solution:
call Page_ClientValidate() function to force controls do there's validate tasks before goes to another processing.

function CheckForm() {
var result = true;
result = Page_ClientValidate();
if (result){
// Do your task here
}
return result;
}

0 comments:

Post a Comment