I would like to use JQuery to validate my forms. This works well enough if I have a single form on a page, unfortunately, I need to have several forms on one page and have found that the validation quits after the first form. Here's the code:
Code: Select all
<!-- HTML CODE -->
<!-- display first form -->
<div class="formLayout">
<form method="" action="tfc_member.php" id="form1" >
<h4>Login Form</h4>
<label>Username:</label>
<input type="text" name="username" class="required"/><br />
<label>Password:</label>
<input type="password" name="passwd" class="required" /><br /><br />
<label></label><input type="submit" value="Log in"/><br /><br />
</form>
<!-- display second form -->
<form method="" action="" id="form2" >
<h4>Some Other Form</h4>
<label>Account Number:</label>
<input type="text" name="username" class="required"/><br />
<label>Operating District:</label>
<input type="test" name="opDist" class="required" /><br /><br />
<label></label><input type="submit" value="Include This Too"/><br /><br />
</form>
</div>Here's the Jquery code:
Code: Select all
<script>
$(document).ready(function() {
$("#form1, #form2").validate();
}
);
</script>Code: Select all
<script>
$(document).ready(function() {
$("#form").validate();
}
);
</script>Cheers,
Rick