I have a form inside a dialog that appears after clicking in another button. After you clicked on the button the form appears where the user puts some of the values in there. Some of them are required so the have the required attribute attach to them. Am using the validator that is here http://docs.jquery.com/Plugins/Validation/validate from bassistance.de
The JQuery validator loads when the form (medicx) appears to the user (is visible). When the user clicks on the submit button of the form (submedic) the check if it is true or false start. This is the check that always gives true instead of giving false when some of the input that have the required flag are not yet completed. The code is like this:
if ( $('#medicx').is(':visible') == true ) {
$('#formmedic').validate();
}
$('#submedic').click(function() {
alert("Valid: " + $("#formmedic").valid());
});
The form looks like this:
<td><label>First Name:</label></td>
<td><input id="fmfname" name="fmfname" type="text" min="3" pattern="[A-z]{3,}" required="required"/></td>
<td><label>Last Name:</label></td>
<td><input id="fmlname" name="fmlname" type="text" min="3" pattern="[A-z]{3,}" required="required"/></td>
Looking at the documentation, it appears your
inputelements should haveclass="required"rather thanrequired="required".That would explain why your form is always valid – the fields that are supposed to be required aren’t actually marked as required.
Add the
requiredclass and see if that fixes it.I couldn’t see whether the plugin supports the HTML5
requiredattribute or not. If so, it should be simplyrequiredor nothing at all (as per the specification).