Unobtrusive Client Validation without accepting model

Posted by user1010609 on Stack Overflow See other posts from Stack Overflow or by user1010609
Published on 2012-04-01T17:09:10Z Indexed on 2012/04/01 17:30 UTC
Read the original article Hit count: 289

I have simple form like this which accepts only two values string action and editText.Is there a way to enable Unobtrusive Client Validation on this without Data Annotations? Or do I have to accept model and use Data Annotations? I just need it to make sure editText is atleast 5 chars long.

@using (Ajax.BeginForm("Action", "Controller", null, new AjaxOptions { OnFailure = "error", UpdateTargetId = "Pcedit" + @Model.ID}))
    {                                  
    <textarea rows="3" cols="2" name="editText" style="width:100%;"></textarea>
    <br />
    <input type="submit" name="action" value="Save"/>
    <input type="submit" name="action" value="Cancel"/>
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET