Hi,
Since u have created the form for the model Order,
The field title should be referred like
$form->input("Customer.title"); directly.
Now when u r saving use saveAll
$this->Order->saveAll($this->data,array('validate' => 'first'));
All the validation rules can be in ur model itself.
The array('validate' => 'first') specifies that all the models must be
validated first before saving recursively.
Also u have to take into consideration that at present cakePHP supports
recursive saving for first level only.
Think I was helpful.
Regards
Sijo
On Mon, Dec 22, 2008 at 2:42 PM, Hipnotik <[email protected]> wrote:
>
> Hello again ;)
> I have 2 models:
>
> Order:
> hasOne = "Customer"
>
> Customer:
> belongsTo = "Order"
> var $validate = array(lot of rules)
>
> I would like to create a form to provide data for Customer object then
> send form to OrdersController and validate.
>
> How to create proper form?
>
> I have this:
> $form->create("Order", array("action" => "send"));
> $form->input("Order.Customer.title");
> // more fileds
> $form->end("Send")
>
> It sends data to "send" action of OrdersController, but how to create
> Customer object, validate and display errors on the form if occur?
>
> Thanks for help
> >
>
--
Sijo Jose Chakramakkil
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---