Hello there,
I have a setup a form where the user can enter following information
[list]
[*] Campaign Name
[*] Pick a Image for the campaign
[/list]
And dynamically add rows to the form so the user is able to enter
time-frames for type of (sub)campaigns.
When a user would submit the form with two rows the output would look like this at the moment:
My Question is, is this at all usable with DBSave (Multisave)? Or do I have to change the form?
My Idea here would be that the save would save the data two times (as given in the example above).
With each saved row looking like this (again given the data from the example above).
First:
[list]
[*] id (AI)
[*] c_id => (e.g.) 1 (holing a shared ID for all rows submitted)
[*] ct_id => 1 (holding the type_set id for each row)
[*] campaignname => asd
[*] campaignimage => 20151207135615_50117539.jpg
[*] type => 1
[*] start => 2015-12-23
[*] end => 2015-12-27
[/list]
Second:
[list]
[*] id (AI)
[*] c_id => 1
[*] ct_id => 2
[*] campaignname => asd
[*] campaignimage => 20151207135615_50117539.jpg
[*] type => 2
[*] start => 2015-12-24
[*] end => 2015-12-28
[/list]
Please let me know how to either change the form or what steps to take to save the data.
Also (maybe this is also important to know), the form will or should be connected/used with ChronoConnectivity afterwards.
I have a setup a form where the user can enter following information
[list]
[*] Campaign Name
[*] Pick a Image for the campaign
[/list]
And dynamically add rows to the form so the user is able to enter
time-frames for type of (sub)campaigns.
When a user would submit the form with two rows the output would look like this at the moment:
Array
(
[chronoform] => Campaign
[event] => submit
[campaignname] => asd
[id] =>
[type_set] => Array
(
[1] => Array
(
[id] => 1
[type] => 1
[start] => 2015-12-23
[end] => 2015-12-27
)
[2] => Array
(
[id] => 2
[type] => 2
[start] => 2015-12-24
[end] => 2015-12-28
)
)
[button15] => Submit
[campaignimage] => 20151207135615_50117539.jpg
)
My Question is, is this at all usable with DBSave (Multisave)? Or do I have to change the form?
My Idea here would be that the save would save the data two times (as given in the example above).
With each saved row looking like this (again given the data from the example above).
First:
[list]
[*] id (AI)
[*] c_id => (e.g.) 1 (holing a shared ID for all rows submitted)
[*] ct_id => 1 (holding the type_set id for each row)
[*] campaignname => asd
[*] campaignimage => 20151207135615_50117539.jpg
[*] type => 1
[*] start => 2015-12-23
[*] end => 2015-12-27
[/list]
Second:
[list]
[*] id (AI)
[*] c_id => 1
[*] ct_id => 2
[*] campaignname => asd
[*] campaignimage => 20151207135615_50117539.jpg
[*] type => 2
[*] start => 2015-12-24
[*] end => 2015-12-28
[/list]
Please let me know how to either change the form or what steps to take to save the data.
Also (maybe this is also important to know), the form will or should be connected/used with ChronoConnectivity afterwards.
Here is a screenshot of the form:
Hi jackprince,
Just the DB Multi Save will work OK with a little work to set the data up - though the more usual method would be to use two tables, one for the core data that is only there once - the name and image, etc. - and a second table for the repeated data linked back to the first.
Which of these is better for you?
Bob
Just the DB Multi Save will work OK with a little work to set the data up - though the more usual method would be to use two tables, one for the core data that is only there once - the name and image, etc. - and a second table for the repeated data linked back to the first.
Which of these is better for you?
Bob
... the more usual method would be to use two tables, one for the core data that is only there once - the name and image, etc. - and a second table for the repeated data linked back to the first. ...
I agree. Just didn't know if this doable in a fast way with DBSave action.
In the end some php and joomla core DB functions are possible as well.
Hi jackprince,
You can do it - I don't know that it is any faster or slower than your approach. Use one DB Save action to save the code data; after that the id of the new record is available in the $form->data[' array']; use a Custom Code action to add that to each of the type_set sub arrays; use a Multi DB Save for those.
Bob
You can do it - I don't know that it is any faster or slower than your approach. Use one DB Save action to save the code data; after that the id of the new record is available in the $form->data[' array']; use a Custom Code action to add that to each of the type_set sub arrays; use a Multi DB Save for those.
Bob
Thanks Bob, enjoy the coffee😉
This topic is locked and no more replies can be posted.