I am using Ajax.BeginForm and wish to pass in parameters to the function called with OnBegin. The following are two code snippets.
new AjaxOptions
{
HttpMethod = "POST",
UpdateTargetId = "DataEntrySummary",
OnBegin = "ValidateForm(11,55)"
}
function ValidateForm(minAge, maxAge) {return false;}
The parameters are passed in correctly to the ValidateForm function but the function always returns true.
If I take the parameters out and use
OnBegin = "ValidateForm()"
function ValidateForm() {return false;}
It works perfectly and returns false. Am I missing something or are parameters not allowed here or ...
Puzzled of Oxford - thanks in advance.
PS - I cannot use C# Attributes and Unobtrusive validation for very good reasons (these are code snippets).