i am working on mvc4 and would like to add more than a tag on the form. what i had had before was (because i have images to post:
@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" }))
I would like to add to this form the id. I have looking from this link (How to add ID property to Html.BeginForm() in asp.net mvc?) which has show me that i need to do like this
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "signupform" }))
But due to the fact that my form already have a tag, i don't know how i can add the other tag. The real thing that i would like to do is to change the class of a html element with Jquery basis on the fact that form is valid or not, i have read from these link that i need to use the name of the form to do this (how to check if a form is valid programmatically using jQuery Validation Plugin) and (Catch Client Side Validation failure). By combining these answer, i obtain the following javascript code:
$("#bucton").click(function () {
if (!$('form_id').valid()) {
$('.firstclass').addClass('secondclass').removeClass('firstclass');
}});
where bucton is the name of the input which allows submitting the form and firstclass and secondclass are class to change. any help would be appreciated