Wednesday 27 July 2016

MVC Form OnSubmit Client side function calling

html-beginform-using-onsubmit-to-validate

@using (Html.BeginForm("Save", "ReadingsEntry", FormMethod.Post, 
new { enctype = "multipart/form-data", onsubmit = "validateForm(event)" }))

//add javascript function like validateForm(event){//do your code}
<script>
function validateForm(event)
{
//do your code
}
</script>

No comments:

Post a Comment