如何使编辑视图字段不填充现有数据

时间:2014-05-04 09:04:10

标签: cakephp

我的edit.ctp中有以下代码:

<div class="employees form">
<?php echo $this->Form->create('Employee'); ?>
    <fieldset>
        <legend><?php echo __('Edit Employee Details'); ?></legend>
    <?php
        echo $this->Form->input('id');
        echo $this->Form->input('employee_name', array('required'=>false));
        echo $this->Form->input('date_hired',array('required'=>false,'id'=>'datepicker','type'=>'text'));
        echo $this->Form->input('employee_phone_number', array('required'=>false));
        echo $this->Form->input('employee_email', array('required'=>false));
        echo $this->Form->input('employee_address');
        echo $this->Form->input('employee_dob',array('required'=>false,'id'=>'datepicker2','type'=>'text'));
        echo $this->Form->input('access_level', array('required'=>false, 'options' => array('admin' => 'Admin', 'staff' => 'Staff')));
        echo $this->Form->input('employee_username', array('required'=>false));
        echo $this->Form->input('employee_pw', array('required'=>false));
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>

当我进入编辑视图时,所有字段都会填充现有数据。即使密码已存在,我希望密码字段保持空白。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

echo $this->Form->input('employee_pw', array('type'=>'password', 'value'=>'', 'autocomplete'=>'off'));