Я создал приложение с командой cake bake, и одна таблица использовала текст в качестве типа поля.
Все сработало, для этого поля была сгенерирована текстовая область, и она работает, как и ожидалось.Я сохранил несколько записей, просмотрел их, отредактировал несколько.
Я понял, что одна запись не заполняла текстовую область при использовании редактирования.Он отображается правильно в представлении, но при редактировании данных нет в текстовой области и сохранении, что приводит к потере всей информации.
И это произошло с обычной запеченной таблицы.
вот значение, которое я использовал в текстовой области:
Утро Кристофер,
Пожалуйста, вы можете выслать мне пароль для наших учетных записей электронной почты в Citano, так как он нам нужен для сброса электронной почты моих директоровза его ежевику.
· В этом вопросе требуется ваш срочный ответ.
Jaques Kruger Citano Distributors.
Да, там есть странный персонаж,Я думаю, что пункт из слова.
Это ошибка фреймворка, которая была исправлена позже?Я тестировал на 1.3.10 и 1.3.8.
Любая помощь будет оценена.
Редактировать:
Вот стандартный запеченный вид "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>
А вот контроллер:
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);
}
}
Как я уже говорил, данные уже добавлены, и с данными все в порядке,но при редактировании текстовая область не всегда заполняется существующими данными, тогда как остальные поля всегда заполняются существующими данными.
Отладка данных в 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
)
)
)