我正在我的 View 中做一个 cakephp 表单并单击按钮,我想在执行某个操作之前评估值,问题不是我,在另一个 View 中我有完全相同的代码,如果它有效,但在这里,不要。但是,我没有任何错误控制台。
echo $this->Form->create('Detalle', array('class'=>'form_center', 'type'=>'file','id'=>'detalle_form'));
echo $this->Form->input('FechaEvento', array('type'=>'hidden','value'=>$fecha_evento));
if($SuperAdmin and !$evento['Evento']['gratuito']){
echo $this->Form->input('Inscripcion.cortesia', array('type'=>'checkbox', 'value'=>1, 'label' => utf8_encode('Cortesía'), 'div' => 'input checkbox inputRutPasaporte'));
echo $this->Form->input('Inscripcion.boleta_no_generar', array('type' => 'hidden', 'value' => 0));
}
$options_btn = array('label' => __('Pagar'), 'class' => 'btn_blue', 'div' => false);
echo $this->Form->end($options_btn);
JavaScript:
<script type="text/javascript">
$(document).ready(function(){
<? if($evento['Evento']['generar_boleta']){ ?>
<? if($evento['Evento']['habilitar_compra_multiple']){ ?>
$('#detalle_form').data('callback', function(form){
alert("TEST");
});
<? } ?>
<? } ?>
});
</script>
最佳答案
代码看起来不错,但重点是我们需要有关您的控制流的信息。我认为由于不同而缺少变量。 我建议你
将代码组合成 CakePHP element在 View 中调用,因此您只需编写一次代码(保留代码 DRY )
将调试级别设置为 2
安装 CakePHP 调试套件 DebugKit on Github
检查缺失的变量和错误
如果问题仍然存在,请相应地向我们提供更多信息
关于javascript - 表单方法post和jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32569262/