I am new to cakePHP, I have submit button in cakePHP
$ajax->submit(
'Submit',
array(
"update" => "gridbox_script",
"url" => '/flots/comparaison_gridbox_update',
"div"=>"button_submit",
"loading" => "setIboxOpacity = setOpacity;showBG();showIndicator();" ,
"complete" => "hideBG();hideIndicator()"
)
);
I would like to add one javascript validation, if the validation returns true then it should proceed for submission otherwise submission should be terminated.
The whole submission is calling through ajax and I was advised to use $ajax to implement.
my javascript function:
var firstCompare = new Array();
fucntion myValidation(){
var otherCompare = new Array();
if(document.getElementById("file1").checked)
otherCompare.push('file1');
result = (otherCompare.length === _.intersection(otherCompare, firstCompare).length);
firstCompare = otherCompare;
return result;
}
Please help me.