Reputation: 23
The problem:
when the input type on my submit button is changed to 'button' it does NOT save info to mysql but validation works. If i change it to input type on submit button to 'submit' it saves info to mysql but the validation does not work. Is there a resolution to this?
jquery validation - function on click:
$("input:button").click(function(){
var retVal = false;
$.each([1, 2], function(i, val){
retVal = (validate(val) || retVal);
});
return retVal;
On my form the submit button code is:
<input type="submit" value="Submit" />
The form action is:
<form name="list1"; action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
Upvotes: 0
Views: 108
Reputation: 29170
I think the right way to do this is to the leave the button as <input type='submit' />
and use $('form').submit(...)
to return true/false
based on the validation.
Upvotes: 0
Reputation: 27755
Write $("input:submit")
instead $("input:button")
in your jQuery code
Upvotes: 2