Form update and PDF saved & updated

Help Desk ›› How to ›› Form update and PDF saved & updated
30 August, 2018 22:19:29
Carophil
Topics: 3
Messages: 7
I have a form already filled and I change a field value. I click on update but the pdf isn't saved in tpl/"templateID"/save.
Could you help me?

Many Thanks

Philippe
30 August, 2018 23:22:19
E2Pdf
Support
Topics: 7
Messages: 3331
Hi,

Sorry, what do you mean by changing a field value? And "Update"?

PDFs are generating on the fly. You can export pdf from E2Pdf Export page and download it.

Are you using shortcode [e2pdf-save] shortcode with success message?

If it's possible can you please clarify which task are you trying to complete so we can advice you a solution?

We remain at your service.
We would really appreciate your feedback at WordPress.org!
31 August, 2018 10:49:01
Carophil
Topics: 3
Messages: 7
Oh sorry I'll try to be more specific.
1 - I have build a Form with Formidable Forms. This form can be modified.
2 - I have build a pdf based on the forms above
3 - When I change a value in the form and I update the form (the data in the form) the pdf is not created and if it exist, it is not updated with the new data.

PS: I have put the "Save" shortcode in sucess and update messages.

Many thanks for your help
Philippe
31 August, 2018 12:13:20
E2Pdf
Support
Topics: 7
Messages: 3331
Thank you. Now it's a bit more clear.

Just to confirm: Are you editing entry from Admin Dashboard? Or from Frontend?

If from Admin Dashboard - "Success Message" and "Update Message" not firing by Formidable in this case.

You can use custom code in your functions.php to have applied [e2pdf-save] shortcode on "frontend" and "backend" edit:

add_action('frm_after_update_entry', 'after_entry_updated_e2pdf', 10, 3);
function after_entry_updated_e2pdf($entry_id, $form_id) {
if ($form_id == '3') {
do_shortcode('[e2pdf-save id="14" dataset="' . $entry_id . '" apply="true"]');
}
}

Where:
14 - E2Pdf Template ID
3 - Formidable Form ID

This action will fire on any update (Backend and Frontend).

Let us know if there is some misunderstanding. Thank you.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
31 August, 2018 13:51:19
Carophil
Topics: 3
Messages: 7
Hello Oleksandr,

Many thanks. It works perfectly.

I would like to add the name parameter. In may form, the name parameter is name="[173]-[174]-[id]".
Could you help me?

Many thanks

Philippe
31 August, 2018 13:56:01
E2Pdf
Support
Topics: 7
Messages: 3331
Glad to hear that it worked.

You can add any parameter that is available for [e2pdf-save] shortcode the same way:

Updated code with "name" attribute which must work:

add_action('frm_after_update_entry', 'after_entry_updated_e2pdf', 10, 3);
function after_entry_updated_e2pdf($entry_id, $form_id) {
if ($form_id == '3') {
$entry = FrmEntry::getOne($entry_id);
if ($entry) {
$v1 = FrmEntryMeta::get_meta_value($entry, '173');
$v2 = FrmEntryMeta::get_meta_value($entry, '174');
$v3 = $entry_id;
$name = $v1 . "-" . $v2 . "-" . $v3;
do_shortcode('[e2pdf-save id="14" dataset="' . $entry_id . '" name="' . $name . '" apply="true" filter="true"]');
}
}
}

We remain at your service.
We would really appreciate your feedback at WordPress.org!