JQuery modal box form validation

Posted by vikitor on Stack Overflow See other posts from Stack Overflow or by vikitor
Published on 2010-04-14T15:09:30Z Indexed on 2010/04/14 21:13 UTC
Read the original article Hit count: 162

Filed under:
|
|

Hi, I was using a view to create an object for my specific project, but now I have to adapt this to another requirements, such as the creation of this object must be integrated in the creation of another one. The thing is, that this object must be created before starting to create the other one, and the way of doing it will be poping up a modal dialog box with JQuery with the form to create it. I've got to adapt the creation and it works fine, except for the validation messages. It is made in the controller like :

if (not.NotName.Trim().Length == 0)
{
    ModelState.AddModelError("NotName", "Name is required");
}
if (_notification.checkIfExists(not.NotName, not.NotRecID))
{
    ModelState.AddModelError("NotName", "Notification already exists");
}

And before with a normal view it worked fine, but now I'm not able to get the validation messages as I did. How can you get this validation messages thrown by the controller in the Modal Box? Because now when I made a mistake on purpose in the form in order to get the error it doesn't appear. I've seen the error is displayed in the site, because I've seen it on firebug, but it doesn't appear in my model box. How can I retrieve this errors? Do you know any tutorial that could help me with this?

Thank you

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET