How to show the updated text from AI field in Formidable Forms to the PDF file

21 August, 2024 11:41:18
Topics: 1
Messages: 2
Hi,
I am wondering how to show the edited text generated by AI in AI field in Formidable Forms to the E2PDF PDF file. When I trigger the action SUBMIT(button) to create the PDF, it shows the original (first-time generated) text in the PDF, not the edited version. Why E2PDF can't register or pull the edited version of the AI generated text?
Can you help me to solve this problem?

Best regards,
21 August, 2024 12:25:03
E2Pdf
Support
Topics: 7
Messages: 3335
Hello,

E2Pdf should output the value that is saved under the Formidable Forms entry.

1. Which value do you see under the saved entry?

2. Can you please clarify how do you edit the field?

3. Do you use [e2pdf-download] or [e2pdf-attachment] shortcode in the "Success Message" / "Mail action"?
We would really appreciate your feedback at WordPress.org!
21 August, 2024 12:31:21
Topics: 1
Messages: 2
Thank you for your fast response!
1. The value is only [12]. That is the ID of the field in Formidable forms.
2. That field (the AI field) doesn't allow editing originally. I created an HTML so the AI field could be editable. Her is the HTML:

<div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
<label for="field_[key]" id="field_[key]_label" class="frm_primary_label">[field_name]
<span class="frm_required" aria-hidden="true">[required_label]</span>
</label>
[input]
<div id="frm_ai_response_[id]" class="frm_ai_response frm_description" contenteditable="true">
[if loading]<div class="frm_ai_loading"></div>[/if loading]
</div>
<input type="hidden" id="hidden_ai_response_[id]" name="hidden_ai_response_[id]" />

[if description]<div class="frm_description" id="frm_desc_field_[key]">[description]</div>[/if description]
[if error]<div class="frm_error" role="alert" id="frm_error_field_[key]">[error]</div>[/if error]
</div>

<script>
document.getElementById("frm_field_[id]_container").addEventListener("input", function() {
// Oppdater den skjulte inputen med innholdet fra contenteditable div
var editedContent = document.getElementById("frm_ai_response_[id]").innerText;
document.getElementById("hidden_ai_response_[id]").value = editedContent;
});
</script>

3. I use [e2pdf-download]
21 August, 2024 12:44:06
E2Pdf
Support
Topics: 7
Messages: 3335
Unfortunately, it's the issue with your code. We just checked it on our side and Formidable Forms doesn't store modified value, we still see the original AI value at the "Formidable" -> "Submissions" page, and exactly that value is shown in the PDF.

It needs to modify the code to store the edited value by the Formidable Forms so you can see it at saved submission by Formidable Forms, and in this case, E2Pdf should output the correct value.
We would really appreciate your feedback at WordPress.org!