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