php - CakePHP 2.4: Unwanted pre-filled form data -
i have form add new user. admin logged in may access form. unfortunately, username , password of admin filled form fields expected clear. , 1 strange thing is: username printed birthday field!
i cannot explain myself how works. , not found in www post person has got same problem - found questions , answers pre-filled form data wanted.
this view /users/add.ctp
<h1>add new member</h1> <?php echo $this->form->create('user', array('url' => base_url.'/users/add', 'action'=>'post')); ?> <table class="form"> <tr><td>username:</td><td><?php echo $this->form->input('user.username', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> <tr><td>name:</td><td><?php echo $this->form->input('user.name', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> <tr><td>lastname:</td><td><?php echo $this->form->input('user.lastname', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> <tr><td>e-mail:</td><td><?php echo $this->form->input('user.email', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> <tr><td>birthday:</td><td><?php echo $this->form->input('user.birth', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> <tr><td>password:</td><td><?php echo $this->form->input('user.password', array('label' => false, 'div' => false, 'value' => ''));?></td></tr> </table> <?php echo $this->form->submit('submit', array('formnovalidate' => true)); echo $this->form->end(); ?>
and here controller /userscontroller.php
public function add() { $this->layout = 'admin'; if ($this->request->is('post')) { // saving data $this->user->create(); if ($this->user->save($this->request->data)) { $this->session->setflash(__('data saved.')); return $this->redirect(array('action' => 'view')); } $this->session->setflash(__('data not saved.')); } }
by way: saving works fine. of course, admin of object user, new member added. think, here lies problem, not know... thinking problem whole day :( know do?
thanks in advance.
is not browser? (saved username/password when type first time)
so, can turn of autocomplete.
<?php echo $this->form->create('user', array('url' => base_url.'/users/add', 'action'=>'post', 'autocomplete' => 'off')); ?>
this option => 'autocomplete' => 'off'
Comments
Post a Comment