Hello Bob and Max,
In this example my form data array contains the following elements:
I want some of these elements to be saved in table 1 (model ID table_1) and some to save in table 2 (model ID table_2). I know that I can use php to code something like this:
Is there a way to code the actual form element using the model ID (or some other means) so that I don't have to code each element? If not, is there a better way to save the various form data array elements to their respective tables?
Hope this makes some sense.
Thanks for your help.
In this example my form data array contains the following elements:
Data Array:
Array
(
[Itemid] => 524
[option] => com_chronoconnectivity
[task] => submit
[cb] => 158
[Surplus_date] => 2013-01-11
[Disposal_date] => 2013-01-12
[Notes] => None
[submit] => Submit
[2b8df311d25738c6d31845ebcb11bdd0] => 1
[user_id] => bi01d35
[date_created] => 01-02-2013
)
I want some of these elements to be saved in table 1 (model ID table_1) and some to save in table 2 (model ID table_2). I know that I can use php to code something like this:
<?php
$form->data['table_1']['Surplus_date'] = $form->data['Surplus_date'];
$form->data['table_2']['Notes'] = $form->data['Notes'];
?>
Is there a way to code the actual form element using the model ID (or some other means) so that I don't have to code each element? If not, is there a better way to save the various form data array elements to their respective tables?
Hope this makes some sense.
Thanks for your help.
Hi Chris,
The DB Save action will add to/update any columns with names that match form inputs. Unless you have columns in both tables with the same name and different values then you shouldn't need to do anything. Just use two DB Save actions.
The exception to this would be if there are multiple records to be saved in one of the tables, at present the DB Save actions can't sensibly handle this.
Bob
The DB Save action will add to/update any columns with names that match form inputs. Unless you have columns in both tables with the same name and different values then you shouldn't need to do anything. Just use two DB Save actions.
The exception to this would be if there are multiple records to be saved in one of the tables, at present the DB Save actions can't sensibly handle this.
Bob
This topic is locked and no more replies can be posted.