Php – How to reset all of the form fields in a view when I refresh the page in CakePHP


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

Best Solution

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.