Figured it out when I woke up this morning...

<?php echo $form->input ( 'OrderRow.' . $ix . '.amount' ); ?>
<?php echo $form->hidden( 'OrderRow.' . $ix . '.product_id', array
( 'value' => $product['Product']['id'] ) ); ?>
<?php echo $form->hidden( 'OrderRow.' . $ix . '.size_id', array
( 'value' => $size['id'] ) ); ?>

$ix is the row number in the form, starting with 0.

/Jakob

On 22 Jan, 00:09, Jakob Malm <[email protected]> wrote:
> Hi,
>
> I have an order form, with a number of rows, one for each product and
> size. The user can type in a simple input field the number of products
> of that size he/she would like to order.
>
> The following models and relationships exist:
> Order, hasMany { OrderRow }
> OrderRow, hasOne { Product, Size } (+ a field called amount)
> Product, hasAndBelongsToMany { Size }
> Size, hasAndBelongsToMany { Product }
>
> How do I make form elements that include the id's of Product and Size
> of the specific row, and the amount, all included in the data
> correctly? In my mind, something like the following:
>
> $form->input ( 'OrderRow.product_id.size_id.antal' );
>
> and somehow populate the product_id and size_id fields with the
> correct values.
>
> I appreciate any help,Jakob
--~--~---------~--~----~------------~-------~--~----~
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