Home Jquery Unobtrusing Validation says that a field doesn't have value when I load it from parameters using .Net Helpers
Reply: 0

Jquery Unobtrusing Validation says that a field doesn't have value when I load it from parameters using .Net Helpers

F. Penteado
1#
F. Penteado Published in 2017-09-13 23:15:00Z

I have a code that sometimes loads values from another page, which I pass as a parameter to my main page. On my controller, I receive it put it on a View Model, and then, load it in my view using an html helper. On the client side, I'm using Jquery validator to validate the required fields. The problem is: when I do this, load all the values and click to submit, the validator tells that the field has no value and focus that field.

My controller is something like this:

public ActionResult Index(string string1, string string2, string string3)
{
    ViewModel vm = new ViewModel
    {
        str1 = string1,
        str2 = string2,
        str3 = string3
    };

    return View(vm);
}

And on my view is something like this:

<div class="col-xs-5">
    <div class="row">
        @Html.TextBoxFor(m => m.str1, new { @class = "form-control" })
    </div>
</div>

What am I doing wrong? Am I forgetting something?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.397685 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO