开发者

Page_ClientValidate is undefined in formview

开发者 https://www.devze.com 2023-03-05 04:36 出处:网络
I have validators inside a <asp:formview>, in order to show custom validation I am using if (!Page_ClientValidate(\"groupName\")) {}

I have validators inside a <asp:formview>, in order to show custom validation I am using

if (!Page_ClientValidate("groupName")) {}
开发者_如何学JAVA

I am getting an error Object Expected. How can I validate client side from the form view?

I use Page_ClientValidate for <asp:listview> and there


The Page_ClientValidate function may sometimes be undefined, e.g. if there are no validators on the page. Check if typeof Page_ClientValidate === "function" before calling it.


This would also occur if all validator's EnableClientScript properties are set to false.


Call the following Javascript function whenever you want and pass the validation group name of your form to it..

        function ValidateForm(ValidationGroupName)
        {
          var validated=Page_ClientValidate(ValidationGroupName); 
          if(validated)
          {
            //do the logic here
            return true;
          }
          else
          {
            return false;
          }
        }

Hope this will help you....

0

精彩评论

暂无评论...
验证码 换一张
取 消