[eluser]SPeed_FANat1c[/eluser]
I am using
form validation plugin.
Edit: made a short version:
Code:
<scri+pt src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></scri+pt>
<s+cript src="http://www.ylakiudarzelis.lt/js/jquery.validate.js" type="text/javascript"></s+cript>
<scr+ipt>
$(function(){
$('input.save').click(function() {
$('form').attr( 'target', '' );
valid = $(".edit").validate({
rules: {
input_pavadinimas: {
required: true,
maxlength: 20,
remote: "http://www.ylakiudarzelis.lt/admin_/info_psl/name_check_ajax"
}
}
}
).form();
//alert('');
if(valid)
alert('valid');
else alert('not valid');
//document.myform.submit();
});
});
</scr+ipt>
<form action="http://www.ylakiudarzelis.lt/test/valid" method="post" class="wide edit" name="myform">
<br /><label for="label">Puslapio pavadinimas:*</label>
<input type="hidden" name="name" value="asdasd" />
<input type="text" name="input_pavadinimas" value="asdasd" maxlength="20" size="10" style="width:20%" /><br /><br />
<br>
<input class = "save" type="button" value="Išsaugoti" />
</form>
php validation always echoes false
Code:
function name_check_ajax()
{
echo 'false';
}
When I run this code, I get an alert "valid" and after alert the message appeards near input field - "Please fix this field."
What do I need to change there so the variable "valid" could be set to false?