adding input dynamic

2014-11-18 Thread Davidson Santos
I am trying to create a dynamic input but it does not send the data someone 
could help me?

Add.ctp:

div class='related'

?php $this-Html-script('jquery-2.0.0.min.js',array('inline' = false)); 
?

table id='band_list'

th?php echo $this-Form-input('Pedido.0.descricao'); ?/th

th?php echo $this-Form-input('Pedido.0.quantidade'); ?/th

th?php echo $this-Form-input('Pedido.0.unidade'); ?/th

th?php echo $this-Form-input('Pedido.0.desconto'); ?/th

th?php echo $this-Form-input('Pedido.0.subtotal'); ?/th

/table
button id='add_band'Add Band/button

script type='text/javascript'
var contador = 1;
$('#add_band').click(function(event) {
event.preventDefault(); 
$('#band_list').append('th?php echo 
$this-Form-input(Pedido.'+contador+'.descricao); ?/th');
$('#band_list').append('th?php echo 
$this-Form-input(Pedido.'+contador+'.quantidade); ?/th');
$('#band_list').append('th?php echo 
$this-Form-input(Pedido.'+contador+'.unidade); ?/th');
$('#band_list').append('th?php echo 
$this-Form-input(Pedido.'+contador+'.desconto); ?/th');
$('#band_list').append('th?php echo 
$this-Form-input(Pedido.'+contador+'.subtotal); ?/th');
   $('#band_list').append('tbody/tbody');
contador++;
});
/script

?php echo $this-Form-end('Salvar');

echo $this-Html-link('Cancelar', array('action'='index'));

?
/div


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

2014-11-18 Thread cesar calvo
$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:

 div class='related'

 ?php $this-Html-script('jquery-2.0.0.min.js',array('inline' = false)); 
 ?

 table id='band_list'

 th?php echo $this-Form-input('Pedido.0.descricao'); ?/th

 th?php echo $this-Form-input('Pedido.0.quantidade'); ?/th

 th?php echo $this-Form-input('Pedido.0.unidade'); ?/th

 th?php echo $this-Form-input('Pedido.0.desconto'); ?/th

 th?php echo $this-Form-input('Pedido.0.subtotal'); ?/th

 /table
 button id='add_band'Add Band/button

 script type='text/javascript'
 var contador = 1;
 $('#add_band').click(function(event) {
 event.preventDefault(); 
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.descricao); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.quantidade); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.unidade); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.desconto); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.subtotal); ?/th');
$('#band_list').append('tbody/tbody');
 contador++;
 });
 /script

 ?php echo $this-Form-end('Salvar');

 echo $this-Html-link('Cancelar', array('action'='index'));

 ?
 /div


 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

2014-11-18 Thread euromark
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:

 div class='related'

 ?php $this-Html-script('jquery-2.0.0.min.js',array('inline' = false)); 
 ?

 table id='band_list'

 th?php echo $this-Form-input('Pedido.0.descricao'); ?/th

 th?php echo $this-Form-input('Pedido.0.quantidade'); ?/th

 th?php echo $this-Form-input('Pedido.0.unidade'); ?/th

 th?php echo $this-Form-input('Pedido.0.desconto'); ?/th

 th?php echo $this-Form-input('Pedido.0.subtotal'); ?/th

 /table
 button id='add_band'Add Band/button

 script type='text/javascript'
 var contador = 1;
 $('#add_band').click(function(event) {
 event.preventDefault(); 
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.descricao); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.quantidade); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.unidade); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.desconto); ?/th');
 $('#band_list').append('th?php echo 
 $this-Form-input(Pedido.'+contador+'.subtotal); ?/th');
$('#band_list').append('tbody/tbody');
 contador++;
 });
 /script

 ?php echo $this-Form-end('Salvar');

 echo $this-Html-link('Cancelar', array('action'='index'));

 ?
 /div


 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.