My Order model belongsTo both a DeliveryContact and a BillingContact.
It looks like this:

class Order extends AppModel {

    var $belongsTo=array(
        'DeliveryContact'=>array(
            'className'=>'Contact'
        ),
        'BillingContact'=>array(
            'className'=>'Contact'
        )
    );

}


My view looks like this:

echo $form->create('Order');
echo $form->input('DeliveryContact.name');
echo $form->input('DeliveryContact.address');
echo $form->end('Next');

And in my controller action for this view I have something like:

$this->Order->DeliveryContact->set($this->data['DeliveryContact']);
if ($this->Order->DeliveryContact->validates()) {
     proceedToNextStep();
}

The validation errors are not being pulled through properly. If I do
debug($this->validationErrors) in my view I get:

Array
(
    [Contact] => Array
        (
            [name] => Please enter your name
            [address] => Please enter your address
        )

)

Clearly I need to be populating
View::validationErrors['DeliveryContact'] instead of
View::validationErrors['Contact'], but I don't know how to accomplish
this, any ideas?


Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to