id is null or not an object?

Jul 8, 2011 at 10:11 PM

I get the following error when run in IE: Microsoft JScript runtime error: 'id' is null or not an object. 

Looking into this it occurring in the following part of the javascript:

foolproof.getId=function(a,b) {var c=a.id.lastIndexOf("_")+1; 

Unraveling the data, I see that a is undefined when calling the function. b is the name I define in the condition ("SetsMax")

        [LessThanOrEqualTo("SetsMax", ErrorMessage = "Maximum sets must be greater than or equal to starting sets")]
[Required(ErrorMessage = "You must specify a number of sets (use zero for none)")] [Range(0, int.MaxValue, ErrorMessage = "Sets must be positive")] public int Sets { get; set; } [Required(ErrorMessage = "You must specify a maximum number of sets (use zero for none)")] [Range(0, int.MaxValue, ErrorMessage = "Maximum sets must be positive")] [DisplayName("Max Sets")] public int SetsMax { get; set; }

In my testing both values in the model had values, though making the condition true or false seems to make no difference as the error occurs always.

I had this issue before, and never found a solution (http://foolproof.codeplex.com/discussions/237773) this is particularly curious as I have updated to the latest MVC Foolproof and completely rewrote the majority of my code/data/conditions.

 

 

 

Coordinator
Jul 11, 2011 at 2:20 PM

What version of MVC are you using? If 3, do you have unobtrusive validation turned on or off?

Jul 13, 2011 at 4:17 PM

I am using version 2.