Cakephp javascript onclick提交函数在视图


Cakephp javascript onclick submit function on view

我试图使用Javascript的onclick提交函数对Cakephp网站的视图文件,它似乎不做任何事情,当它被点击…

有什么建议吗?

<?php echo $form->submit('  Preview  ', array('label'=>false,'name'=>'submit','id'=>'print_log')); ?>
<a id="print_log" href="#" onclick="this.form.submit()" name="submit">
<?php echo $html->image("btn_preview.jpg",array("alt" => "Preview")); ?>
</a>

<a>不是表单元素(而<input><button>是),因此this.form是未定义的。与CakePHP无关