Hi Adobe Engineers,
We have a use case where XDP template is used to render the form as HTML. This form contains the HTML submit button. The user accesses this form from an URL, fills the data and clicks the HTML submit button. The outputService.generatePDFOutput() method is used to generate a flat PDF and it is sent to the client browser. The HTTP submit button is not visible in the flat PDF since its field property is set to 'visible (screen only)' . But if this same form is saved as interactive PDF using formsService.renderPDFForm() method then the HTTP submit button is present in the output interactive PDF.
What needs to be done differently to generate interactive forms without the presence of HTTP submit button?
Thanks is advance for the response.
Leena
Views
Replies
Total Likes
Maybe you can check the Xfa.host property and based on that hide or show the http submit button
Some questions for clarity will help in understanding the use case better
- If I understood correct, you created an XDP form (using Designer?) and then you are rendering the XDP form as HTML, how are you doing that?
- Also, how are you handling form submission? Are you using custom submit handler on AEM Forms OSGi?
- Finally, why do you not want the Submit button on the interactive PDF, don't you want the user to Submit the PDF form?
I can replicate the issue in-house.
The HTTP button is visible in the output PDF with Forms service invocation irrespective of the presence set for the button while we see the expected output PDF with the Output service.
To unblock your work, you can hide or show the button by changing the presence values at run time based on the use case. More information here- https://help.adobe.com/en_US/AEMForms/6.1/DesignerScriptingBasics/WS92d06802c76abadb57cc1b6e12a92343...
Hope this helps!
Hi Pulkit & Nikhil,
Thanks for the quick response.
Pulkit, on replicating the issue and solving it, what event in designer was used to hide the HTML button or regular button, when it's presence was already set to 'Visible (screen Only)'? I tried the scripts in 'Scripting the presence values for buttons' section in the link you had provided and it did not work for me. Why is this below script not sufficient to hide the button in the saved interactive form.
form1.Subform1.Button1::click - (JavaScript, client)
xfa.form.form1.Subform1.Button1.presence="hidden"; xfa.form.form1.Subform1.Button1.relevant = "-print";
Is there a reason why the button's 'Visible (screen Only)' property is working for outputService.generatePDFOutput() and not working for formsService.renderPDFForm()?
Nikhil, regarding use case, the generated flat PDF is sent to the client, and the interactive PDF is saved in the server file system for further processing. We are using custom code to render the XDP template as HTML form using a specific URL. It is not an adaptive form. The submission handler processes the submitted form.
Thanks,
Leena
@aemuser001 Thanks for getting back. Checking this one further.
Hello workflowuser | Employee,
I received the below message and I don't think this is the correct answer. If there is no current solution for this, please let me know and we can move on.
Thanks,
Leena
Correct Answer by workflowuser | Employee Maybe you can check the Xfa.host property and based on that hide or show the http submit button
form1::docReady - (JavaScript, client)
if (xfa.host.name == "Acrobat") {
this.resolveNode("HTTPSubmitButton1").presence = "invisible";
}
This is working. You may need to test the xfa.host.name for the PDF opened in reader
Hello Workflowuser Employee,
Thank you for testing and providing the code. It worked.
So the issue with the visibility of the buttons was not in the Designer, AEM application, submission handler or the PDF forms generator, but this extra code is needed to prepare the PDF to be opened in the PDF reader without the buttons.
This code needs to be added in all the XDP forms, and there are hundreds of XDP templates/forms with multiple buttons in them. Is there an efficient way of adding this or similar code/script in one location, may be in the POST.jsp in /crx/de when a form is submitted? Or is there any other suggestion of handling this case efficiently?
Thanks,
Leena
to add the code to hundreds of xdp's, you will probably have to manipulate the xml of the xdp and insert the following code programmatically in the xml
<event activity="docReady" ref="$host" name="event__docReady">
<script contentType="application/x-javascript">if (xfa.host.name == "Acrobat") {
this.resolveNode("HTTPSubmitButton1").presence = "invisible";
}
</script>
Hello Workflowuser,
Thanks for the suggestion. Greatly appreciated.
~Leena
HI WorkFlowuser,
Just realized during testing that the script/code works for buttons in the body pages, but if the buttons are in the master page (Example: form1.#pageSet[0].Page1.HTTPSubmitButton1::docReady - (JavaScript, client)
) then the buttons are still visible in the generated interactive form when viewed from Adobe Acrobat Reader DC or Adobe Acrobat Pro 2017.
Any help in hiding the buttons in the master pages will be greatly appreciated.
Thanks,
Leena
The script is at the form1 event
form1::docReady - (JavaScript, client)
//+ GENERATED - DO NOT EDIT (ID:050B56E3-17A2-4D55-8A10-6B58FAB8E0F9 CRC:2450640584)
//+ Type: Action
//+ Result1: SetPresence("$Node2","hidden")
//+ Node2: form1[0].#pageSet[0].Page1[0].HTTPSubmitButton1[0]
//+ Node1: form1[0]
//+ Condition1: Form("$Node1","docReady")
//+ ActionName: form1.docReady
if (xfa.host.name != "XFAPresentationAgent") {
this.resolveNode("#pageSet.Page1.HTTPSubmitButton1").presence = "hidden";
}
//-
Hi workflowuser,
The script worked for buttons in the master page in form1::docReady - (JavaScript, client).
To hide the buttons in the form body i used the earlier suggestion to check the xfa.host.name for "Acrobat" in form1::initialize - (JavaScript, client).
Lesson learned - I tried to hide both the master and body page buttons in form1::docReady, but it did not work for me even when the path was fully qualified. I had to separate them in two different events, may be because the Master Page set is different from Body Page hierarchy nodes.
Thank you for the help. The solution is provided.
Leena
Glad it worked for you
Views
Likes
Replies