Form submits but by passing the form validation when button.click is used
- by Cuty Pie
I am using form validation plugin as well as html5 attribute=recquired with input type=button or submit and fancybox.when button is clicked ,both validation proceedures work(notification of empty inputs appeare),but instead of this notification ,form is submitted.
If I dont use button.click function but use simple submit.then validation works perfectly
plugin==http://validatious.org/
javascript function
$(document).ready(function() {
$('#send').click(function() {
$(this).attr("value", 'Applying...');
var id = getParam('ID');
$.ajax({
type:'POST',
url:"send.php",
data:{option:'catapply', tittle:$('#tittle').val(), aud:aud, con:con, adv:adv, mid:$('#mid').val(), aud2:aud, cid:$('#cid').val(), scid:$('#scname option[selected="saa"]').val(), gtt:$('input[name=gt]:radio:checked').val(), sr:$(":input").serialize() + '&aud=' + aud},
success:function(jd) {
$('#' + id).fadeOut("fast", function() {
$(this).before("<strong>Success! Your form has been submitted, thanks :)</strong>");
setTimeout("$.fancybox.close()", 1000);
});
}
});
});
});
AND Html is here
<form id="form2" class="validate" style="display: none" >
<input type='submit' value='Apply' id="send" class="sendaf validate_any" name="jobforming"/>