Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

File Renames itself on Submit

Avatar

Former Community Member

I have an enabled form that attaches the full pdf to an outgoing email when the 'Submit' button is selected.  If nothing is completed on the blank form (ie. not changed) then when the 'Submit' button is clicked an email is initiated with the pdf attached (this is fine and as expected).  However, if the form is changed at all (ie. some of the fields are filled in - which is what we want) and the 'Submit' button is clicked and email is initiated with the pdf attached, however, the attachement is now renamed to what it was plus "- Adobe Reader.PDF" added to the end of the name.

I need to get rid of this appending to the pdf attachment name.  Why is this happening and can it be stopped.  Note that if the pdf is opened within an internet explorer window this does not occur.  Can I either stop this from happening when the user opens the pdf directly (ie. not via internet explorer) or can I somehow note within the form itself (perhaps under the email logic) to always send with a certain name?

Thank you for your ideas.

6 Replies

Avatar

Level 10

The application name is added to the file name, when the form has been changed but wasn't saved before submitting.

You can either save the form or use a script to manipulate the dirty flag.

Where to put this script depends on how the other scripts work in the form work.

It's often not that easy, as it can have unwanted side effects when it's executed in the wrong place.

Avatar

Former Community Member

Thank you for the suggestions.  I was hopeful that the "event.target.dirty = false" option would work.  I tried placing it at the beginning on the 'on click' code for the 'submit' button.  Unfortunately, this didn't seem to help - the attached file to the email still gets the application name added to the file name.

Do you have any suggestion as to where best to place this code.  The form is pretty straightforward - a number of fields to fill in and a 'submit' button to select when you are ready to email it.

Thank you in advance for any further guidance you can provide.

Avatar

Former Community Member

My mistake.  Actually, upon placing the "event.target.dirty = false" line at the beginning of the 'on click' code for the 'submit' button it appears that I have resolved the issue.  Just need to really test up the form now to ensure it hasn't caused any other issues (as you noted it can have unwanted side effects).  Thank you.

Avatar

Former Community Member

Actually, I have found that placing the "event.target.dirty = false" line at the beginning of the code for the 'submit' button does eliminate the renaming of the attachment to the email, however, it also blanks out any data that has been entered (so a blank form is attached to the email).  So, still tinkering to find a solution...

Avatar

Level 10

You can try to write two functions in a script object you the call from your submit button.

Assuming the script object is named "Actions" and contains these scripts ...

... you then can call these functions back to back from your submit button (use a regular button for this scenario).

Here's a simple example form:

https://acrobat.com/#d=oHV1lMWG031H1Ai2GAfTPQ

Avatar

Former Community Member

Thanks Radzmar.  I have tried this but, unfortunately, the same thing is happening.  The individual puts some data into the form and selects the submit button.  The actions (resetdirty and send) are obviously executed because it is emailed out.  However, the attachment on the email continues to be a blank form (assume the resetdirty is doing this).  I have found that if I do use a regular email button (without trying to use resetdirty etc) that although it does rename the form when changed/emailed it doesn't add as much to the name as when I use a regular button.  In particular, when I was using the regular button to email it would add quite a bit to the end of the file name (would change from "Form.pdf" to "Form.pdf - adobe reader.pdf").  When I use the regular email button it appears to just add a '[1]' or similar at the end (would change from "Form.pdf" to "Form[1].pdf").  This is more bearable for me although ideally I would like the file name to remain unchanged.