tags:

views:

136

answers:

2

How to reset all the fields in the form on each refresh in CakePHP?

+2  A: 

Are you asking how to make Cake not put data into the forms automatically, when using the form helper inside a view? If so, Cake just takes the data inside Controller::$data and uses matching array indeces to field names to populate those fields. To stop this, just set $this->data = null; in your controller's action that corresponds to the view.

Travis Leleu
A: 

As mentioned you can make all form data unreachable by setting $this-data to null. You can also view the HTML page generated, what names the form elements have, and can selectively unset $this->data['objectName'] or $this->data['objectName']['memberName'].

sibidiba