1

I am trying to do some basic Jquery Validation in my MVC2 project and I keep getting this error...

Microsoft JScript runtime error: Object doesn't support property or method 'validate'

Even before the page loads at this simple script...

    $("#temp1").validate({
        rules: {
            HospitalFinNumber: {
                required: true,
                minlength: 6
            },
            AdminDate: { requried: true }
        }
    });

temp1 is the id of my form, in that form there are id's for HospitalFinNumber, and so on and so forth... Any idea what could be going on? Here are the js files I have included in my site.master

<link href="<%=ResolveClientUrl("~/Content/Site.css")%>" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=ResolveClientUrl("~/Content/jqUIcss/jquery-ui-1.8.15.custom.css")%>" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=ResolveClientUrl("~/Content/jqGrid/ui.jqgrid.css")%>" />   
<script src="<%=ResolveClientUrl("~/Scripts/js/jquery-1.6.2.min.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/js/jquery-ui-1.8.15.custom.min.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/lib/jquery.metadata.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jquery.validate.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jquery.validate.min.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jquery.jqGrid.min.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.locale-en.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.base.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.tbltogrid.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jqDnR.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.common.js")%>" type="text/javascript"></script>
SoftwareSavant
  • 8,456
  • 26
  • 107
  • 186
  • Ok whats the deal? If I put this jquery library into my file Then my jquery UI doesn't work? Cheese and Rice this jquery stuff makes me want to jump off of a bridge – SoftwareSavant Aug 25 '11 at 14:07
  • Ok place the jquery.js file onto the page where validation will occur, Possibly the validation file files also? – SoftwareSavant Aug 25 '11 at 14:13
  • Use the "Net" tab in Firebug or Chrome's developer tools to look at what scripts are actually being loaded, and whether any of them are giving you errors. Chances are that you've got a malformed URL or something. – StriplingWarrior Aug 26 '11 at 14:01

1 Answers1

0

Jquery and validation scripts need to be reference in all pages where the validation is use, this rule applies to all javascript files and css.

To avoid repeat the reference you can include them in masterpage

JAS
  • 294
  • 2
  • 7