page_isvalid is undefined
Hi, I have a javascript fucntion that only runs if the page is valid, so in the function I have
Code:
if (Page_IsValid == true) {
}
When debugging locally this is fine, but when on the server I get an undefined error for page_IsValid.
I did some research and in framework 1 a jscript file was included in the aspnet_client folder that exposed this object, appearently with version 2 and above this is now all wrapped into the framework.
As I am using 3.5 it should be working, are there any IIS settings I need to make.
thanks in advance
Re: page_isvalid is undefined
May be you are missing the Javascript file which contains the Page_IsValid function. Check the file
Re: page_isvalid is undefined
Quote:
Originally Posted by
danasegarane
May be you are missing the Javascript file which contains the Page_IsValid function. Check the file
As mentioned in my post I don't think a javascript file is needed past framework 1.
Re: page_isvalid is undefined
I have no idea. Hope some help
Re: page_isvalid is undefined
Do you actually have any asp.net validators on your page?
When you add validators (such as <asp:RequiredFieldValidator />) to your page, all the required script is added by asp.net. So if you inspect your page you should see a section similar to the following:
Code:
<script type="text/javascript" src="/TestArea/WebResource.axd?d=1vW1DNui2GcIDk5r6qXmVLWLFw6_x4xP_-ytaaINNjXt29wBlMh1zxk3jG8TBm0zlvAsRVqAxbjQNUxzX13tZMcR0PA1&t=634244866920000000">
var Page_ValidationVer = "125";
var Page_IsValid = true;
var Page_BlockSubmit = false;
...
This is where Page_IsValid gets defined.
Re: page_isvalid is undefined
In order for the Page_IsValid to be present, then the server needs to have the required JavaScript file available to it. Check the JavaScript files that are being referenced by your page, what are they?
Gary
Re: page_isvalid is undefined
Thanks for the replies all, Ive sorted it now. Was an issue with virtual directory but thanks for the help
Re: page_isvalid is undefined
Glad to hear that you got it working!
Can you remember to mark your thread as resolved?
Thanks
Gary
Re: page_isvalid is undefined
I shall make every endeavour to remember in future
Re: page_isvalid is undefined
Quote:
Originally Posted by
davebat
I shall make every endeavour to remember in future
thank you :thumb: