I'm trying to use the jQuery validation plugin to validate forms, but I need to completely remove the ability for it to use the name attribute. Part of my form is created dynamically based on a counter being incremented and I simply want to use classes only.
Is there a way to do this?
I've implemented the addClassRules method and added all my classes for each field, but if I remove the class from the field it still validates based on the name field.
This is really starting to get frustrating.
jQuery.validator.addClassRules({
username: {
required: true,
minlength: 2,
remote: "whatever.php"
}
});
etc.
<div class="control-group">
<label class="control-label" for="username">
<?php echo $entry_username; ?>
</label>
<div class="controls">
<input type="text" class="input-large"
name="username" id="username"
value="<?php echo $username; ?>" required>
</div>
</div>
As you can see this element does NOT have a class of username, but the validation falls back to use the name attribute if the class isn't present.
I want to use classes ONLY for validation.
Thanks.