More in this section
Forums / Developing with Sitefinity / ASP.NET MVC Validation

ASP.NET MVC Validation

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Nick
    Nick avatar
    15 posts
    30 Oct 2013
    26 May 2014
    Link to this post

    Hi all,

    I have a quick question regarding MVC validation within MVC widgets.  I've noticed that on-submit validation works beautifully - the form gets sent, fails to validate and I can show any relevant messages for the user to correct.

    I was wondering if there's any support for the inline validation that MVC would normally allow - where each field is validated on the fly rather than on submit?


  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    06 Sep 2017
    27 May 2014
    Link to this post
    Hello Nick,

    Along with your server-side validation, you can add a client-side validation by using for example JavaScript, where to add a violation message and/or to hide/deactivate the submit button (example).

    Below is the sample code used in the View:
        function test() {
            var name = document.getElementById('name').value;
            if (name.length >= 3) {
                document.getElementById('err1').setAttribute("style", "display: none");
            else {
                document.getElementById('err1').setAttribute("style", "color:red; display: inline-block");
    <form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
        First name:
        <input type="text" name="fname" onchange="test()" id="name">
        <span id="err1" style="display:none">Please enter at least 3 charecters</span>
        <br />
        <input type="submit" value="Submit">

    You could check the proposed solution in that forum post also.

    Svetoslav Manchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered