Ignore fields to validate using jquery.validate.1.8.1

0

I have a project in the company where I'm interning and I've had some mistakes in validating some inputs. I use ASP.NET MVC, Razor, and Javascript. At the time of submitting all the fields I get an error. When using the Chrome console I discovered that this field:

@Html.HiddenFor(m => m.Material.DateCreated)

Not valid. When I went to see the value, it was correct so I guess I do not need to validate because the value always comes from the controller. What I wanted to do is use something like this:

$("#myform").validate({
ignore: "#target"
});

It seemed to have the solution, but in my code what I have is '$ form.valid ()' and I do not know how to implement this 'ignore' as in the above code because it gives error. I found the version that is in the project outdated because I can not find anything on google with valid () , only validate () appears to me.

    
asked by anonymous 18.01.2017 / 20:46

1 answer

0

The solution I found for my problem was as follows:

I took the

@Html.HiddenFor(m => m.Material.DateCreated)

and in the POST action in controller I put the current date like this:

Material.DateCreated = DateTime.Now;

The difference now is that I do not put the date in the GET action and I went around.

    
19.01.2017 / 13:48