Populating repeaters with data from another form

Populating repeaters with data from another form

You are here:

[vc_row][vc_column][vc_column_text]

Issue

Client wants to pre-populate a repeater section with rows from another form.

Use Case

Client is a food service business.  There's a form containing all the food choices.  There's an order form for customers to place an order.  Client wants to populate the order form with some/all of the items from the food choice form.

Solution

Use the formidable filter frm_setup_new_field_vars and move the data from the source form to the target form by looping over the source data and creating a new repeater row for each row of source data.

Credits to

Phil Clayton (@Phil Clayton on the Formidable Slack channel) for having this situation.

Caveats

Important!  If your for is multipage form AND you're posting values from that page, this hook will get called for each page.  In this case you have to put code in the snippet below to make sure that it's only run for the page you want, or else, when the data is submitted, if the repeaters are not on your last page, all blank values will be submitted.  The code will look something like this:

$page_order = FrmAppHelper::get_param('frm_page_order_'. FrmForm::get_id_by_key([your form key]), false);
if ($page_order != [# of the page]) {
return $values;
}

Code

[/vc_column_text][vc_raw_html]JTNDYmxvY2txdW90ZSUzRSUwQSUzQ3ByZSUzRSUwQWFkZF9maWx0ZXIlMjglMjdmcm1fc2V0dXBfbmV3X2ZpZWxkc192YXJzJTI3JTJDJTIwJTI3ZnJtX3BvcHVsYXRlX2d1ZXN0X29wdGlvbnMlMjclMkMlMjAyMCUyQyUyMDMlMjklM0IlMEFmdW5jdGlvbiUyMGZybV9wb3B1bGF0ZV9ndWVzdF9vcHRpb25zJTI4JTIwJTI0dmFsdWVzJTJDJTIwJTI0ZmllbGQlMjAlMjklMjAlN0IlMEElMDklMjBpZiUyMCUyOCUyMCUyNGZpZWxkLSUzRWlkJTIwJTNEJTNEJTIwJTVCaWQlMjBvZiUyMHRoZSUyMHJlcGVhdGVyJTIwc2VjdGlvbiU1RCUyMCUyOSUyMCU3QiUwQSUwOSUwOSUyMCUyNGFycklkcyUyMCUzRCUyMGFycmF5JTI4JTI5JTNCJTBBJTA5JTA5JTIwJTBBJTA5JTA5JTIwJTJGJTJGJTIwZ2V0JTIwYWxsJTIwdGhlJTIwZGF0YSUyMGZyb20lMjB0aGUlMjBTT1VSQ0UlMEElMDkl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MDklMDklMjAlMjAlMjAlMjAlMkYlMkYlMjBrZWVwJTIwZ29pbmclMjBpZiUyMHlvdSUyMG5lZWQlMjBtb3JlJTBBJTA5JTA5JTA5JTIwJTI0Y291bnQlMkIlMkIlM0IlMEElMDklMDklMjAlN0QlMEElMDklMDklMjAlMEElMDklMjAlN0QlMjAlMEElMDklMjByZXR1cm4lMjAlMjR2YWx1ZXMlM0IlMEElN0QlMEElM0MlMkZwcmUlM0UlMEElM0MlMkZibG9ja3F1b3RlJTNF[/vc_raw_html][/vc_column][/vc_row]

Table of Contents
info@fog.org
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram