为什么cakephp没有填充textarea?

Nig*_*olf 0 cakephp-1.3

我使用cake bake命令创建了一个app,一个表使用text作为字段类型.

一切顺利,为该领域生成了一个textarea,它按预期工作.我保存了几个条目,看了几个.

我意识到在使用编辑时,一个条目没有填充textarea.它在视图中正确显示,但是当编辑数据不在textarea中并保存时会导致所有信息丢失.

这发生在一张普通的烘焙桌上.

这是我使用textarea的值:

早上克里斯托弗,

请您在Citano向我发送电子邮件帐户的密码,因为我们需要它来重置我的黑莓手机电子邮件帐户.

·在此问题上您需要紧急回复.

Jaques Kruger Citano经销商.

是的,那里有一个奇怪的角色,我认为从一个词开始.

这是一个框架错误,后来修复了吗?我在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>
Run Code Online (Sandbox Code Playgroud)

这是控制器:

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

正如我之前所说的,该数据已经被添加,并没有什么不对的数据,但在编辑文本区域并不总是与现有数据填充,而其余字段总是与现有的数据填充时.

在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
                )

        )

)
Run Code Online (Sandbox Code Playgroud)

Syn*_*max 7

确保~/app/config/core.php使用此:

Configure::write('App.encoding', 'UTF-8');  
Run Code Online (Sandbox Code Playgroud)

布局部分

<?php echo $html->charset(); ?>  
Run Code Online (Sandbox Code Playgroud)

数据库配置

class DATABASE_CONFIG {
    public $default = array(
        ...
        'encoding' => 'utf8'
    );
}
Run Code Online (Sandbox Code Playgroud)

并阅读本文

http://book.cakephp.org/view/1616/x1-3-improvements