I’m a beginner in asp.net. I tried the CustomValidator and put my_fun() Javascript function into the ClientValidationFunction property. I get that error :
Microsoft JScript runtime error: Object expected
But when i remove the parentheses i get no errors at all.
Why does that happen ?
I think what’s happening is: when you put the name of the function without parentheses, you are putting in a reference to a function object. You are indicating which function should be called.
When you put in the function name with parentheses, you are calling the function. You are indicating that the function to be called should be the result of the function specified.
If your function doesn’t return anything, the code that attempts to call the validation function will have nothing to call, and there will be an error.