I have a form that contain a submit button. I’m using form.validation plugin
I have already set the rules. It’s ok!
But now I created a link out of form that when the user clicks, i would like to change these rules. Is it possible?
For example:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<script type="text/javascript">
$().ready(function() {
$(".myform").validate({
rules: {
name: {
required: true
},
email: {
required: true
},
}
});
});
</script>
<form class="myform">
Name: <input type="text" name="name">
Email: <input type="text" name="email">
Phone: <input type="text" name="phone">
<input type="submit" value="Send">
</form>
<a href="#">Call me</a>
When the user clicks on “Call me”, the validation would be only the “phone” field.
There is lots wrong with this code both syntactically and structure
should look more like