Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Given a form with two textboxes (as a simple example of the issue)
When the first textbox has a class of 'required'
And the second textbox's value has been set programmatically
Then validation on the first textbox should happen
BUT IT DOES NOT!
Below is a sample HTML to illustrate the issue. Follow the instructions at the bottom to manually reproduce the issue.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script><script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script><script type="text/javascript"> $(document).ready(function () { $("#myForm").validate(); $('#text2').val('2'); // this causes validation of #text1 not to happen $('#text2').focus(); });</script><form action=""> <label for="text1">Text 1 *</label> <input name="text1" type="text" /> <br/> <label for="text2">Text 2</label> <input name="text2" type="text" /> <br/></form><h1>Instructions</h1><para> Because the JavaScript programmatically sets the value of Text 2, jquery.validate doesn't properly validate the required field Text 1. <br/><br/> (1) Focus should automatically be on Text 2<br/> (2) Press Shift-Tab to put focus on Text 1 (or use the mouse)<br/> (3) Type 'a' and then press Tab to put focus on Text 2<br/> (4) Press Shift-Tab to put focus back on Text 1 (or use the mouse)<br/> (5) Press Backspace to clear out the value in Text 1<br/> (6) At this point, the validation message should occur, but it doesn't!<br/> <br/> Comment out the JavaScript line "$('#text2').val('2');" and try the test again... validation will work.</para>Metadata
Metadata
Assignees
Labels
No labels