Hi Kekin, it is very kind of you help this poor Cake novice. It have been
hard programing days.
Ok, if I have a hidden ID field of the Addresses I think it is going to
work. But why do I have to put the Addresses ID and the other entities work
without it?
Here is the form:
PS: Thanks again for your patience
<?
echo $this->Form->create($buyer);
?>
<div class="col-md-8 col-sm-8 col-xm-8 col-centered">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><?= __('Atualizar dados de cadastro')
?></h4>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-8"><?=
$this->Form->input('user.name',['label' => __('Nome')]);?></div>
<div class="col-md-4"><?= $this->Form->input('cpf',['label'
=> __('CPF')]);?></div>
</div>
<div class="row">
<div class="col-md-4"><?=
$this->Form->input('user.username',['label' => __('Email')]);?></div>
</div>
<div class="row">
<div class="col-md-2">
<?= $this->Form->label(__('Sexo'));?>
</div>
<? $options = array('Masculino' => __('Masculino'),
'Feminino' => __('Feminino'));?>
<div class="col-md-2">
<?= $this->Form->radio('gender', $options);?>
</div>
<div class="col-md-6">
<?= $this->Form->label('birthdate',__('Data de
nascimento'));?>
<?= $this->Form->input(
'birthdate',
array (
'label' =>
false,
'minYear' =>
date('Y') - 100,
'maxYear' =>
date('Y') - 12,
'empty' =>
true,
'monthNames' => true,
'default' => ''
)
);
?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?=
$this->Form->input('user.addresses.0.phone',['label' => __('Telefone')]);?>
</div>
<div class="col-md-4">
<?=
$this->Form->input('user.addresses.0.celphone',['label' =>
__('Celular')]);?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?=
$this->Form->input('user.addresses.0.zipcode',['label' => __('CEP')]);?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?=
$this->Form->input('user.addresses.0.line1',['label' => __('Endereço e
número')]);?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?=
$this->Form->input('user.addresses.0.line2',['label' => __('Complemento e
Bairro')]);?>
</div>
</div>
<div class="row">
<div class="col-md-5">
<?= $this->Form->input('user.addresses.0.city',['label'
=> __('Cidade')]);?>
</div>
<div class="col-md-3">
<?=
$this->Form->input('user.addresses.0.state',['label' => __('Estado')]);?>
</div>
<div class="col-md-4">
<?=
$this->Form->input('user.addresses.0.country_id',['options' =>
$countries,'label' => __('PaÃs')]);?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?php
echo $this->Form->label(__('Preferências musicais'));
echo $this->Form->input('genres._ids',
[
'templates' => ['checkboxWrapper' => '<div
class="col-md-3"><div class="checkbox">{{label}}</div></div>'],
'options' => $genres,
'multiple' => 'checkbox',
'label' => false,
//'value' => $buyer
]);
?>
</div>
</div>
<div class="row">
<div class="col-md-12">
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $this->Form->label(__('Receber novidades'));?>
<?= $this->Form->input('newsletter',['type' =>
'checkbox','value' => 'Sim','hiddenField'=>'Não', 'label' => __('Quero
receber email de novidades do Prefiro Vinil')]);?>
</div>
</div>
<?
//hidden fields
?>
<div class="row">
<div class="col-md-1">
<div class="control-group">
<?= $this->Form->button(__('Salvar'), ['class' =>
'btn-success']) ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?= $this->Form->end() ?>
Em quarta-feira, 20 de abril de 2016 01:11:37 UTC-3, heavyKevy escreveu:
>
> Does your edit form have an input for the address_id?
>
> something like:"user.addresses.0.id"
>
> I see the id: (29) for the address in the debug output of the entity...
>
> If you need further help with it, you are going to need to show the edit
> form in order to figure out what may be missing.
>
> Hope that helps...
> Best regards,
> Kevin
>
>
--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
We will soon be closing this Google Group. But don't worry, we have something
better coming. Stay tuned for an updated from the CakePHP Team soon.
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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 [email protected].
For more options, visit https://groups.google.com/d/optout.