I created an app with the cake bake command, and one table used text as a field type.
All worked out well, a textarea was generated for that field and it works as expected.
I saved a few entries, viewed them edited a few.
I realised that one entry did not populate the textarea when using edit. It displays correctly in the view, but when editing the data is not in the textarea and saving that causes all the information to go missing.
And this happened with from a normal baked table.
here is the value I used it the textarea:
Morning Christopher,
Please can you send me the password for our email accounts at Citano as we need it to reset my directors email account for his blackberry.
· Your urgent response is required in this matter.
Jaques Kruger
Citano Distributors.
Yes there is a strange character in there, I think a bullet point from word.
Is this a framework bug, that was fixed later?
I tested on 1.3.10 and 1.3.8 .
Any help would be appreciated.
Edit:
Here is the standard baked view "edit.ctp":
<div class="tickets form">
<?php echo $this->Form->create('Ticket', array('type'=>'file'));?>
<fieldset>
<legend><?php __('Edit Ticket'); ?></legend>
<?php
echo $this->Form->input('Ticket.id');
echo $this->Form->input('Ticket.name', array('label' => 'Ticket name'));
echo $this->Form->input('Ticket.details'); # Problem textarea not populating
echo $this->Form->input('Ticket.user_id', array('label' => 'Assigned to'));
echo $this->Form->input('Ticket.queue_id');
echo $this->Form->input('Ticket.client_id', array('options' => $clients,'default' => $defaultClient,'empty' => 'None'));
echo $this->Form->input('Ticket.status', array('options' => $ticketStatus));
echo $this->Form->input('Ticket.accepted', array('type' => 'checkbox'));
echo $this->Form->input('Ticket.linkedticketid', array('options' => $linkTickets,'empty' => 'None','style' => 'width:100%;','label' => 'Linked ticket'));
echo $this->Form->input('Ticket.due_date');
echo $this->Form->file('attachment');
echo $this->Form->input('email', array('label' => 'Additional email to mailing list'));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
<h3><?php __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('View Ticket', true), array('action' => 'view', $this->Form->value('Ticket.id'))); ?> </li>
<li><?php echo $this->Html->link(__('List Ticket', true), array('action' => 'index')); ?> </li>
</ul>
</div>
And here is the controller:
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid ticket', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Ticket->save($this->data)) {
$this->Session->setFlash(__('The Ticket has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The Ticket could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Ticket->read(null, $id);
}
}
As I said before, the data has already been added, and there is nothing wrong with the data, but when editing the textarea does not always populate with existing data, while the rest of the fields always populates with existing data.
Debug Data in edit.ctp
Array
(
[Ticket] => Array
(
[id] => 281
[linkedticketid] =>
[user_id] => 1
[queue_id] => 4
[name] => password
[details] => Morning Christopher,
Please can you send me the password for our email accounts at Citano as we need it to reset my directors email account for his blackberry.
� Your urgent response is required in this matter.
Jaques Kruger
Citano Distributors.
[status] => 0
[accepted] => 0
[due_date] => 2011-11-12
[mailedtech] => 1
[uuid] => 34b12707-0b87-11e1-97b4-001e90d15e95
[created] =>
[modified] => 2011-11-10 12:48:51
)
[User] => Array
(
[id] => 1
[group_id] => 1
[name] => Christopher
[username] => Nightwolf
[password] => 8be1083780671a3b3541ff82r161d3d55a4e5d79
[email] => Christopher@example.com
[created] => 2011-09-05 13:30:56
[modified] => 2011-09-05 13:31:34
)
[Queue] => Array
(
[id] => 4
[name] => Christopher
[rank] => 20
[created] => 2011-09-05 13:58:40
[modified] => 2011-09-05 13:58:40
)
[Task] => Array
(
)
[Ticketforclient] => Array
(
[0] => Array
(
[id] => 95
[ticket_id] => 281
[client_id] =>
[created] => 2011-11-10 12:34:45
[modified] => 2011-11-10 12:48:51
)
)
[Ticketnote] => Array
(
)
[Ticketsinqueue] => Array
(
[0] => Array
(
[id] => 67
[ticket_id] => 281
[queue_id] => 4
[created] =>
[modified] => 2011-11-10 12:48:50
)
)
[Activitylog] => Array
(
)
[Billinginfo] => Array
(
)
[Attachment] => Array
(
)
[Ticketmailinglist] => Array
(
[0] => Array
(
[id] => 11
[ticket_id] => 281
[emailaddress] => christopher@example.com
[originalsender] => 0
)
)
)
Make sure
~/app/config/core.phpuse this:Layout section
Database Config
And Read This
http://book.cakephp.org/view/1616/x1-3-improvements