Validate form fields when the form is posting

时间:2016-07-11 19:05:35

标签: jquery forms ajax.beginform

I designed a form (using Ajax.BeginForm method) for POST and GET dual purposes. Default HTTP method is GET. I am

 @using (Ajax.BeginForm("action", "Home",
    null,
    new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "updateArea",
        HttpMethod = "Get",
    }){
       /* Form fields,*/
       <input id="Add" type="button" value="Add" /> 
       <input id="Search" type="submit" value="Search" /> 
    }

How do I validate the form only when the form is posting (for instance $.post or $.ajax({type:'POST'}))?

0 个答案:

没有答案