@kalai
you need to check that $this->data is not empty when adding a building

been a while since I used 1.3 but I just baked a project after updating my base of 1.3

I put you code in first without validation in the model (my view were baked too)

I have not trouble editing buildings or adding new entries (after the change on the if state of the add method - guess that was typo which is why baking is soo nice)

next I added the validation code.

I am not sure what your exact setup is for the buildings table or the intended purpose of each field. I see the identifier to my thinking this looks like your making an seo friendly retrival field (if so look at the various slug behaviours out there CakeDC Utils or Deuromark Tools plugins)

I see that in your views you are hard setting some stuff (certainly not something I would do)

I am happy to give your actual sql setup a whirl if you like.

Also someone may well spot something I have missed

(I did not encounter that issue with the edit action)

On 17/02/2012 20:23, kalai wrote:
function add() {
                if (!empty($this->data)) {
                        $this->Building->create();
                        if ($this->Building->save($this->data)) {
                                $this->Session->setFlash(__('The building has 
been saved', true));
                                $this->redirect(array('action' =>  'index'));
                        } else {
                                $this->Session->setFlash(__('The building could 
not be saved.
Please, try again.', true));
                        }
                }
        }

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to