You must Sign In to post a response.
  • Category: [About DotNetSpider]

    Validation messages disappearing on scrolling the page

    Hi Experts,

    I am using mvc4, jquery, I have one editform, edit form having the validations and its firing error message properly if the input control is not validated,but if I am trying mouse scroll or window scroll, then automatically the error messages disappearing, I have the same problem in many pages, please suggest me if any body having solution for this.

    Thanks
    Ram
  • #763428
    I hope it will be because of style.

    1. Are you using any styles for that control?
    2. Are you using any style sheet like bootstrap.. etc.

    If any, you have to check there.

    By Nathan
    Direction is important than speed

  • #763432

    Delete Attachment

  • #763443
    Hi Experts,

    I am using mvc4, jquery, I have one editform, edit form having the validations and its firing error message properly if the input control is not validated,but if I am trying mouse scroll or window scroll, then automatically the error messages disappearing, I have the same problem in many pages, please suggest me if any body having solution for this.

    Thanks
    Ram

    Delete Attachment

  • #763490
    Hello Ram,

    I have used this code which worked for me :

    <html>
    <head><title>Untitled<title></head>
    <script type="text/javascript">
    var elements = document.querySelectorAll('input,select,textarea');

    for (var i = elements.length; i--;) {
    elements[i].addEventListener('invalid', function () {
    this.scrollIntoView(false);
    });
    }
    </script>
    <body>
    <form id="form1" action="#">
    <div>

    <input type="text" name="test" placeholder="write your first name" required />

    <input type="submit" value="send">

    </div>
    </form>
    </body>
    </html>


    See the attached image. it's an output i have got.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

    Delete Attachment


Sign In to post your comments