Working with 3 templates within a 2x cakephp form

Asked

Viewed 28 times

0

I’m dying to do this ,as as I work with 3 models within a form, and the form refers to the main model and the other 2 models are associated with this model.

Example: <?php echo $this->Form->create('Escola', array('type' => 'file')); ?> <?php echo $this->Form->input('nome', array('class' => 'form-control')); ?> <?php echo $this->Form->input('descricao', array('class' => 'form-control')); ?> <?php echo $this->Form->input('EscolaTeste.nome', array('class' => 'form-control')); ?> <?php echo $this->Form->input('EscolaTeste.desc', array('class' => 'form-control')); ?> <?php echo $this->Form->input('EscolaNova.nome', array('class' => 'form-control')); ?> <?php echo $this->Form->input('EscolaNova.desc', array('class' => 'form-control')); ?> <?php echo $this->Form->end(); ?>

And in time to save I use saveAll, remembering that Escola is the main model and EscolaTeste and EscolaNova sane hasMany of Escola

  • And what’s going on?

  • Solved, forgot what models in hasMany are treated as array, so the associative models have to have the name this way modeloAssiado.0.field

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.