Have a look here

http://teknoid.wordpress.com/?s=validate+habtm

On Fri, Feb 27, 2009 at 9:30 AM, Günther Theilen <thei...@eqi.de> wrote:
>
> Hi,
>
> maybe I'm a bit dull but I can't figure out what I'm doing wrong here.
> Maybe someone can help:
>
> I've got two models: Foo HABTM Bar.
>
> In foo_controller, add method I do this:
>
> $bar = $this->Foo->Bar->find('list');
> $this->set(compact('bar));
>
> In the foo/add view I have:
> $form->input('Bar', array('multiple' => 'checkbox'))
>
> Which works as I expected.
>
> Now I want to validate the checkboxes.
>
> In models/bar.php I added
> var $validate = array('Bar' => array('rule' => 'testRule'));
>
> function testRule() {
>   debug ("test");
>   die();
> }
>
>
> In foo_controller, add method I tried this:
> $this->Foo->save($this->data)
> and this:
> $this->Foo->saveAll($this->data)
> and this:
> $this->Foo->saveAll($this->data, array('validate' => 'first'))
>
> All my other validation rules in the Foo-model work perfectly but the
> rule in Bar doesn't seem to be triggered.
>
> Where is my mistake?
> Any hints?
>
> Regards
> Guenther
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to