blubberbo blubberbo - 24 days ago 21
C# Question

mvc 5 form validation email address message window over wrong field

I am using MVC 5 form validation to validate the email address field on a form, but the message window that pops up is not over the correct field, see below:

Message Over Wrong Field

This is the code for the 3 fields:

<input class="underlineBox text-box single-line filledIn" data-val="true" data-val-required="The Name field is required." id="Name" name="Name" placeholder="ex. Jon Doe" type="text" value="" data-com.agilebits.onepassword.user-edited="yes">

<input class="underlineBox text-box single-line filledIn" data-val="true" data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." id="Email" name="Email" placeholder="ex. jdoe@unkown.org" type="email" value="" data-com.agilebits.onepassword.user-edited="yes">

<textarea class="underlineBox text-box multi-line filledIn" data-val="true" data-val-required="The Message field is required." id="Message" name="Message" placeholder="ex. Hi Syd, I would like to start a project together." rows="5"></textarea>


Any ideas?

Answer

I am using MVC 5 form validation to validate the email address field on a form, but the message window that pops up is not over the correct field

That's not a picture of jQuery Validate. By default, jQuery Validate simply inserts text next to the field.

That popup you're showing is the HTML5 validation as per your browser. This simply means that your JavaScript/jQuery validation is not working for whatever reason.

Comments