1

I am getting an error when I run the code in Internet Explore 11. It works fine when I run on FF and Chrome. I also checked IE 8 on windows server 2003 server and it works.

error SCRIPT5009: 'Page_ClientValidate' is undefined

javascript code:

function systemValidation() {
   if (Page_ClientValidate()) { .. } }

any ideas why it is failing?

UPDATE

I also tried the code below and still doesnt work. so annoying..

        function validateThis() {
        if (typeof (Page_ClientValidate) === 'function') {
            var isPageValid = Page_ClientValidate('');
            if (isPageValid) {
                alert("page valid");
                return true;
            }
        }
        alert("page NOT valid");
        return false;
    }

are there any other alternatives to do the same task?

Benk
  • 1,284
  • 6
  • 33
  • 64
  • [Used link to add ie.browser to App_Browsers][1] successfully works for me now. [1]: http://stackoverflow.com/questions/20120941/force-ie-11-user-agent-string-using-tags – Benk Apr 17 '14 at 13:25

3 Answers3

1

One more thing, you can prevent runtime errors by updating your code a bit:

typeof(Page_ClientValidate) === "function"
Mark Cooper
  • 6,738
  • 5
  • 54
  • 92
Borys Generalov
  • 2,255
  • 17
  • 19
  • I tried that. no luck, I updated the question with the code, do you mean 3 equal signs? or 2 equal sign? i tried both. not working – Benk Apr 16 '14 at 15:00
  • Can you turn on debugging for your javascript and tell us which row throws an error? I assume this time it is attempt to execute: "var isPageValid = Page_ClientValidate('');" – Borys Generalov Apr 16 '14 at 15:29
  • yeah right, it fails exception says: Page_ClientValidate is undefined. – Benk Apr 16 '14 at 16:10
0

This method IIRC is part of the asp.net client validation library. If the JS file these methods are in isnt being added for some reason (eg you are not producing a WebForms related app) you might be coming a cropper. At least one control would be needed to get this badger emitted:

Jscript include src="/aspnet_client/system_web/1_0_3617_0/WebUIValidation.js

check here: http://msdn.microsoft.com/en-us/library/aa479045.aspx#aspplusvalid_clientside

brumScouse
  • 3,166
  • 1
  • 24
  • 38
  • Where do I find that js file? – Benk Apr 16 '14 at 16:08
  • Its a js file emitted by the framework when a particular type of control (i believe a validation control - guy above explains this) for a more in depth look take a look at that link I included. – brumScouse Apr 17 '14 at 07:18
0

Can you confirm that your layout contains any validation control and the EnableClientScript="true", i.e. something like:

<asp:RequiredFieldValidator id="TextBoxRequiredValidator" 
        controltovalidate="MyTextBox"
        enableclientscript="True"
        display="Dynamic" 
        errormessage="Please enter a value."
        text="*"
        runat="server"/>
Borys Generalov
  • 2,255
  • 17
  • 19
  • Are you providing multiple answers? Isnt it bad form to answer go away find out what's actually happening and then add another answer? Id already pretty much nailed the problem! – brumScouse Apr 16 '14 at 15:35