Re: adding input dynamic
http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html Am Dienstag, 18. November 2014 11:45:35 UTC+1 schrieb Davidson Santos: > > I am trying to create a dynamic input but it does not send the data > someone could help me? > > Add.ctp: > > > > Html->script('jquery-2.0.0.min.js',array('inline' => false)); > ?> > > > > Form->input('Pedido.0.descricao'); ?> > > Form->input('Pedido.0.quantidade'); ?> > > Form->input('Pedido.0.unidade'); ?> > > Form->input('Pedido.0.desconto'); ?> > > Form->input('Pedido.0.subtotal'); ?> > > > Add Band > > > var contador = 1; > $('#add_band').click(function(event) { > event.preventDefault(); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.descricao"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.quantidade"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.unidade"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.desconto"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.subtotal"); ?> '); >$('#band_list').append(''); > contador++; > }); > > > Form->end('Salvar'); > > echo $this->Html->link('Cancelar', array('action'=>'index')); > > ?> > > > > ServicosController.php: > > public function add() { > > if($this->request->is('post')) { > //debug($this->request->data);exit; > $this->Servico->create(); > > if ($this->Servico->saveAll($this->request->data)) { > > $this->Session->setFlash('Os dados do serviço foram salvos.'); > return $this->redirect(array('action' => 'view/'.$this->Servico->id)); > } > else { > $this->Session->setFlash('Os dados do serviço não puderam ser salvos.'); > } > } > #$servico = $this->Servico->findById('all'); > #$this->set('servico', $servico); > > $clientes = $this->Servico->Cliente->find('list'); > $this->set('clientes', $clientes); > > $especialidades = $this->Servico->Especialidade->find('list'); > $this->set('especialidades', $especialidades); > > $vendedores = $this->Servico->Vendedor->find('list'); > $this->set('vendedores', $vendedores); > > $atendentes = $this->Servico->Atendente->find('list'); > $this->set('atendentes', $atendentes); > > $pedidos = $this->Servico->Pedido->find('list'); > $this->set('pedidos', $pedidos); > } > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: adding input dynamic
$this->Form->create is not defined on your view El martes, 18 de noviembre de 2014 08:45:35 UTC-2, Davidson Santos escribió: > > I am trying to create a dynamic input but it does not send the data > someone could help me? > > Add.ctp: > > > > Html->script('jquery-2.0.0.min.js',array('inline' => false)); > ?> > > > > Form->input('Pedido.0.descricao'); ?> > > Form->input('Pedido.0.quantidade'); ?> > > Form->input('Pedido.0.unidade'); ?> > > Form->input('Pedido.0.desconto'); ?> > > Form->input('Pedido.0.subtotal'); ?> > > > Add Band > > > var contador = 1; > $('#add_band').click(function(event) { > event.preventDefault(); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.descricao"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.quantidade"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.unidade"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.desconto"); ?> '); > $('#band_list').append('$this->Form->input("Pedido.'+contador+'.subtotal"); ?> '); >$('#band_list').append(''); > contador++; > }); > > > Form->end('Salvar'); > > echo $this->Html->link('Cancelar', array('action'=>'index')); > > ?> > > > > ServicosController.php: > > public function add() { > > if($this->request->is('post')) { > //debug($this->request->data);exit; > $this->Servico->create(); > > if ($this->Servico->saveAll($this->request->data)) { > > $this->Session->setFlash('Os dados do serviço foram salvos.'); > return $this->redirect(array('action' => 'view/'.$this->Servico->id)); > } > else { > $this->Session->setFlash('Os dados do serviço não puderam ser salvos.'); > } > } > #$servico = $this->Servico->findById('all'); > #$this->set('servico', $servico); > > $clientes = $this->Servico->Cliente->find('list'); > $this->set('clientes', $clientes); > > $especialidades = $this->Servico->Especialidade->find('list'); > $this->set('especialidades', $especialidades); > > $vendedores = $this->Servico->Vendedor->find('list'); > $this->set('vendedores', $vendedores); > > $atendentes = $this->Servico->Atendente->find('list'); > $this->set('atendentes', $atendentes); > > $pedidos = $this->Servico->Pedido->find('list'); > $this->set('pedidos', $pedidos); > } > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
adding input dynamic
I am trying to create a dynamic input but it does not send the data someone could help me? Add.ctp: Html->script('jquery-2.0.0.min.js',array('inline' => false)); ?> Form->input('Pedido.0.descricao'); ?> Form->input('Pedido.0.quantidade'); ?> Form->input('Pedido.0.unidade'); ?> Form->input('Pedido.0.desconto'); ?> Form->input('Pedido.0.subtotal'); ?> Add Band var contador = 1; $('#add_band').click(function(event) { event.preventDefault(); $('#band_list').append('Form->input("Pedido.'+contador+'.descricao"); ?> '); $('#band_list').append('Form->input("Pedido.'+contador+'.quantidade"); ?> '); $('#band_list').append('Form->input("Pedido.'+contador+'.unidade"); ?> '); $('#band_list').append('Form->input("Pedido.'+contador+'.desconto"); ?> '); $('#band_list').append('Form->input("Pedido.'+contador+'.subtotal"); ?> '); $('#band_list').append(''); contador++; }); Form->end('Salvar'); echo $this->Html->link('Cancelar', array('action'=>'index')); ?> ServicosController.php: public function add() { if($this->request->is('post')) { //debug($this->request->data);exit; $this->Servico->create(); if ($this->Servico->saveAll($this->request->data)) { $this->Session->setFlash('Os dados do serviço foram salvos.'); return $this->redirect(array('action' => 'view/'.$this->Servico->id)); } else { $this->Session->setFlash('Os dados do serviço não puderam ser salvos.'); } } #$servico = $this->Servico->findById('all'); #$this->set('servico', $servico); $clientes = $this->Servico->Cliente->find('list'); $this->set('clientes', $clientes); $especialidades = $this->Servico->Especialidade->find('list'); $this->set('especialidades', $especialidades); $vendedores = $this->Servico->Vendedor->find('list'); $this->set('vendedores', $vendedores); $atendentes = $this->Servico->Atendente->find('list'); $this->set('atendentes', $atendentes); $pedidos = $this->Servico->Pedido->find('list'); $this->set('pedidos', $pedidos); } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.