Good evening ladies and gentlemen,
I have an issue about different models in one view (to be precise: one
form).
In the current case i have three Models:
Customer, BillingAddress, DeliveryAddress
The system i am working on is a small shop system.
At the end of the checkout i gather the needed information of the
Customer. The data of the customer is splitted over three Models (see
above) saving in two database tables (DeliveryAddress and
BillingAddress both use the same table).
Now i want all the Automagic of cake, especially the definition of the
textfields (like maxlength if there is a varchar etc.)
I have the following form:
<?php
print $form->create('Customer', array(
'url' => array(
'language' => $LANG,
'controller' => 'orders',
'action' => 'index'
)
));
print $form->input('Customer.firstname_en');
print $form->input('Customer.lastname_en');
print $form->input('Customer.firstname_ja');
print $form->input('Customer.lastname_ja');
....
print '<h2>'.__('billingAdress', true).'</h2>';
print $form->input('BillingAddress.address');
print $form->input('BillingAddress.zip');
....
print '<h2>'.__('deliveryAdress', true).'</h2>';
print $form->input('DeliveryAddress.address');
print $form->input('DeliveryAddress.zip');
.....
print $form->submit();
print $form->end();
This works fine in the controller (validation etc. is no prob), but
only the Customer inputs are formatted correctly (especially the
maxlength attribute). This is because of the connection to the
Customer model (invoked by the $form->create method).
I tested it using 3 different forms on the same page and there it
works, but it doesn't in only ONE form.
Is there any way to change the model the form is connected to so that
the correct attributes of the input fields will apply?
For sure i can use the options array to set the attributes, but that
wouldn't be the nice way.
I can't see a way to accomplish that at the moment, can somebody open
my eyes on that or verify that there is no way (except the options
array) to set the tag attributes correctly?
Thanks in advance,
Joachim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---