Hi everyone, i'm really hoping someone can help me out with this issue, it's driving me nuts!
Using the form php plugin i'm trying to submit and clone a record based on how many repeatable items are added by a user.
For example, when a user submits the form...
My form has a 'feature date' group. The user has added three 'feature dates' which means I need to create three new records. The first record needs to contain the first repeatable 'feature date' value in a non-repeatable date field named 'feature_date', the second record needs to contain the second repeatable 'feature date' value in a non-repeatable date field named 'feature_date', and so on!
In case the above description is confusing, this is how I imagine the php code might look:
So I know how to modify the array of form data, I just don't know how to store each array as a new record?
Thanks in advance for any help
Using the form php plugin i'm trying to submit and clone a record based on how many repeatable items are added by a user.
For example, when a user submits the form...
My form has a 'feature date' group. The user has added three 'feature dates' which means I need to create three new records. The first record needs to contain the first repeatable 'feature date' value in a non-repeatable date field named 'feature_date', the second record needs to contain the second repeatable 'feature date' value in a non-repeatable date field named 'feature_date', and so on!
In case the above description is confusing, this is how I imagine the php code might look:
PHP:
// get the array of repeatable feature dates
$dates = $formModel->formData["mpm_fabrik_deals_8_repeat___feature_date_raw"];
// for each repeatable feature date
foreach ($dates as $date)
{
$formModel->formData('mpm_fabrik_deals___feature_date', $date, true);
$formModel->processToDB();
}
So I know how to modify the array of form data, I just don't know how to store each array as a new record?
Thanks in advance for any help