It looks like you're new here. If you want to get involved, click one of these buttons!
I have been using Fuel for a while now, and I just love it !
I think it's a perfect balance for many things.
I am now trying to go to the next level
I would like to edit invoice details in the CMS, so for example,
Invoice table :
invoice_id, customer_name, address, city, etc ...
Items table :
item_id, invoice_id, description, quantity, price
(one to many)
In the form_fields of my Invoice_model, I added a template field :
$fields['invoice_items'] = [ 'view'=> '_admin/items', 'type' => 'template', 'repeatable' => true, 'fields' => [ 'description' => [ 'style' => 'width: 400px; text-align:left' ], 'quantity' => [ 'style' => 'width: 40px; text-align:center' ], 'price' => [ 'style' => 'width: 60px; text-align:right' ] ] ];
and it displays correctly in the create/edit view.
I have several questions :
1.1 There is a
$valuesarray that can get passed to the template (note the $my_values):
1.2 Yes, you can do it that way.
2. Yes, that's what I've done in the past.
3. That's the preferred way to to do it. There is a
normalized_save_datathat you can sometimes use to get the submitted data in your on_after_save hook in which to loop through and save:
Thanks for your quick response !
I have tried to set $my_values as so :
but the values are not taken into account, am I doing something wrong ?
Are the being passed to the '_admin/items' view in the
If you mean are they displayed in the view, then no
I looked in the code, and I think I found what needs to be done (no 'facture_items' in the array) :
and the name of the variable is 'value'
'value' => $my_values,
Thanks for your help, I will try to go further in this functionality.