0
我是新来CakePHP的,我在CakePHP的
$ajax->submit( 'Submit', array( "update" => "gridbox_script", "url" => '/flots/comparaison_gridbox_update', "div"=>"button_submit", "loading" => "setIboxOpacity = setOpacity;showBG();showIndicator();" , "complete" => "hideBG();hideIndicator()" ) );
提交按钮,我想补充一个JavaScript验证,如果验证返回true,则它应该继续提交,否则提交应该被终止。
整个提交通过ajax调用,我建议使用$ajax
来实现。
我的javascript功能:
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;
}
请帮助我。
我可以在cakePHP'$ ajax-> submit'中添加javascript函数吗? – user2660409 2014-10-27 10:22:21
你正在使用哪个版本的蛋糕?我认为它小于2.x.你可以在js文件中写入函数并根据需要使用它。 – 2014-10-27 10:25:52