Reputation: 81
See code below... jquery validator seems to be rejecting any input entered in the name field. it asks to match the specified format. Is there a default format or something? I am stumped!!!
<script type="text/javascript">
$(document).ready(function() {
$("#signupform").validator();
});
</script>
<body>
<form id="signupform">
<fieldset>
<p><input type="text" name="name" value="Name*" minlength="1" maxlength="40" pattern="[A-Za-z]" required /></p>
<p><input type="email" name="email" value="Email*" required /></p>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</fieldset>
</form>
</body>
</html>
Upvotes: 0
Views: 118
Reputation: 91299
The pattern [A-Za-z]
matches a single character, thus if you type more than one, you'll get a validation error. Use [A-Za-z]+
instead, which means one or more characters in the range A-Z
or a-z
.
Also, this pattern won't match the initial value Name*
due to the asterisk.
Upvotes: 1