I'm new to cakephp and I'm start loving it but today I had a problem on 
adding new data (action add).
After baking users table the result was

public function add() { if ( $this->request->is('post') ) {



I had add some validation on my model to names and more fields. The first 
push on submit button show invalid validation messages but on second click 
on submit did nothing.
I found that the  $this->request->is('post') becomes false after first 
submit. I look on edit action and I see that also ask for put.

to solve this problem all I had to do was 

public function add() { if ( $this->request->is('post') || 
$this->request->is('put') ) {


It's working fine now for me and to to solve it on every baking I 
personalized my baking template on my project
app/Console/Templates/myTemplate/actions/controller_actions.ctp

I really don't know if this is the correct way to solve it, I've never used 
PUT on PHP apps that I made and I don't see a big difference either way.
I comment this because I don't know if is a bug on cake (tested on version: 
2.3.1 - 2.3.3 ). 

I hope this information helps and also I hope to see some comments to 
understand a little bit more.

tags: flash session message validation post put

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to