###What is happening:
{{{
echo $this->form->field('timePeriod.start',
array(
'type' => 'text',
'label' => 'Début des transactions',
'readonly' => true
)
);
}}}
This outputs a blank input field although the timePeriod.start property is correctly set.
{{{
echo $this->form->text('timePeriod.start',
array(
'readonly' => true
)
;
}}}
This correctly outputs the input field with the correct value.
I've looked inside the Form.php (this may be a wrong interpretation from my part) file and it seems that in the first case where we use the **field** method, the **_defaults** method is called more than once and overwrites **options['value']**:
- once from inside the **field** method and overwrites the **$name** of the field (line 715).
- the second time, **field** is called from inside the **text** method and has the wrong **$name** parameter.
Ok the commit fixed for a singleton embedded doc, but if the variable is an array of embedded documents, the value is not set, I have to manually set them like this: {{{ foreach ($account->lineTransactions as $i => $transaction) { echo '<p>'.$id.': '.$transaction->date.' '.$transaction->description.' '.$transaction->amount.' '.$transaction->currency.'</p>'; echo $this->form->hidden('lineTransactions.'.$i.'.date', array('value' => $transaction->date)); echo $this->form->hidden('lineTransactions.'.$i.'.description', array('value' => $transaction->description)); echo $this->form->hidden('lineTransactions.'.$i.'.amount', array('value' => $transaction->amount)); echo $this->form->hidden('lineTransactions.'.$i.'.currency', array('value' => $transaction->currency)); } }}} Is this the normal behavior? It would be great if we could just have: {{{ foreach ($account->lineTransactions as $i => $transaction) { echo '<p>'.$id.': '.$transaction->date.' '.$transaction->description.' '.$transaction->amount.' '.$transaction->currency.'</p>'; echo $this->form->hidden('lineTransactions.'.$i.'.date'); echo $this->form->hidden('lineTransactions.'.$i.'.description'); echo $this->form->hidden('lineTransactions.'.$i.'.amount'); echo $this->form->hidden('lineTransactions.'.$i.'.currency'); } }}}