php - Cakephp comment form input keeps the same value after i press add -
I have created a blog site "Beginner Cake Php With A Newbie Profession" - David Golding. I have the comment view listed below:
& lt; Div class = "comment form" & gt; & Lt ;? Php echo $ form- & gt; Create ('Comment') ;? & Gt; & Lt; Fieldset & gt; & Lt; Legend & gt; & Lt ;? Php __ ('add comment') ;? & Gt; & Lt; / Legend & gt; & Lt ;? Php Acor $ form- & gt; Input ('name'); Counterpart $ form-> Input ('content'); Counterpart $ form-> Input ('post_id'); ? & Gt; & Lt; / Fieldset & gt; & Lt ;? Php echo $ form- & gt; End ('send') ;? & Gt; & Lt; / Div & gt; & Lt; Div class = "verb" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt ;? Php echo $ html- & gt; Link (__ ('list comments', true), array ('action' => 'index')) ;? & Gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt ;? Php echo $ html-> Link (__ ('list post', true), array ('controller' => gt; 'post', 'verb' => 'index')); ? & Gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt ;? Php echo $ html- & gt; Link (__ ('new post', true), array ('controller' = & gt; 'post', 'verb' = & gt; add ')); ? & Gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;
After entering the problem, I remain in the names and content areas. Can anyone help me?
Thanks,
Here are the options:
$ The-> save method, location:
$ this-> After handling the redirect, you can redirect to your controller after submitting it. ('Action' = & gt; 'index'));
Where is the action, where you want to return.
Or you can clear the values, then in the controller, after $$-> save
$ this-> Data ['comment'] ['name'] = ""; Etc ...
Comments
Post a Comment