Jquery Form Validation Plugin Not Working
Posted
by nayanjyoti hazarika
on Stack Overflow
See other posts from Stack Overflow
or by nayanjyoti hazarika
Published on 2010-05-24T11:01:39Z
Indexed on
2010/05/24
11:11 UTC
Read the original article
Hit count: 178
JavaScript
|jQuery
I try to validate a simple Form but the Jquery Validation
Plugin not working when I use only Button not The Submit
Button. I can not use the Submit button there Because If I use submit
Button After Submitting the form It take the Action and goes
to Default page while my current form is comes from Ajax. I am
very new to Jquery. Please Help its Urgent... I am giving the files here. index.html
<html>
<head>
<script src="jquery.js">
<script="jquery-validate-min.js">
<script="validation.js>
</head>
<body>
<form id="contact_form">
<table>
<tr><th>Name</th><td><input name="name" /></td></tr>
<tr><th>E Mail</th><td><input name="email" /></td></tr>
<tr><th><input type="button" name ="submit" id="form_sub"
onclick="save"></th><td><input name="email" /></td></tr>
</table>
</form>
</body>
</html>
Now the validation.js
file
function save(){
$("#form_sub").click(function(){
$("#contact_form").validate({
'rules':{
'name':{
'required':true,
'minlength':5
},
'email':{
'required':true,
'email':true
}
}
})
}
Everything works fine when we use input type="submit"... But it not working when we use input type="button"
Any Idea how can Fix this? I am new to Jquery ... Please Help
© Stack Overflow or respective owner