Home>
I have a question about jquery.validationEngine.
Introduced image authentication securimage in a form
I'm trying to check with validationEngine
One more step? Does not work
form.htnl
<form id ="form">
mail address
<input type ="email"name ="new_mail"class ="form-control input-lg validate [required, custom [email]]">
Image authentication
<input type ="text"name ="captcha_code"value =""class ="validate [required, custom [onlyLetterNumber], ajax [ajaxCheck]]"id ="captcha_code">
<img id ="captcha"src ="/scimg/securimage_show.php"/>
<a onclick ="document.getElementById ('captcha'). src ='/scimg/securimage_show.php?'+ Math.random ();return false"class ="btn btn-warning"&gt ;Image change</a>
<button class ="btn btn-primary"id ="add_acount_send">Register</button>
</form>

common.js
$(document) .on ('click','# add_acount_send', function (e) {
e.preventDefault ();
// First check
if (! $('# form'). validationEngine ('validate', {promptPosition:"bottomLeft"})) {
return false;
}
$.ajax ({
// Asynchronous submission if form has no errors
// If it is a success
)}
)}

jquery.validationEngine-ja.js
-Omitted
"ajaxCheck&quot ;: {
// securimage check
"url&quot ;:"/class/scimg.php&quot ;,
"alertText&quot ;:"* The image does not match the text entered&quot ;,
"alertTextOk&quot ;:"* OK&quot ;,
"alertTextLoad&quot ;:"* Checking"
},
Omitted-

----------------------------------------------- -------------------------------------
scimg.php
session_start ();
if ($_GET ['fieldValue'] == $_SESSION ["securimage_code_disp"] ["default"]) {
echo json_encode (array ($_ GET ['fieldId'], true));
} else {
echo json_encode (array ($_ GET ['fieldId'], false));
}

The execution result is
If i enter your e-mail address and correct image authentication
The green balloon "OK" is displayed on the image authentication form and I cannot proceed.
Of course, an error message balloon will be displayed if you enter it properly for image authentication.
Image authentication is displayed as OK with a green balloon and the email address is also entered
$('# form'). validationEngine ('validate', {promptPosition:"bottomLeft"}) Try alerting
will be false
validate [required, custom [ajax [ajaxCheck]] is a success
Why? ? ? ?
windows7
dreamwaverCC
Chrome