form method post and jquery

时间:2015-09-14 16:11:06

标签: javascript jquery cakephp

I'm doing a cakephp form in my view and clicking on the button, I would like to evaluate values before making a certain action, the problem is not me, in another view I have exactly the same code and if it works, but here , do not. However, I do not have any error console.

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>

1 个答案:

答案 0 :(得分:1)

代码看起来很好但重点是我们需要有关控制流的信息。我假设由于它不同而缺少变量。 我建议你

  • 将代码合并到视图中调用的CakePHP element中,这样您只需编写一次代码(保留代码DRY

  • 将DebugLevel设置为2

  • 安装CakePHP DebugKit DebugKit on Github

  • 检查缺少的变量和错误

  • 如果问题仍然存在,请相应地提供相关信息