Skip to main content
Participating Frequently
August 26, 2023
Beantwortet

Is it possible to send a flattened version of a PDF form but also keep the original fillable form?

  • August 26, 2023
  • 2 Antworten
  • 2339 Ansichten

My PDF form has a "Submit Form" button which submits the form to an e-mail address. I have worked out how to get this to send as a flattened/non-fillable PDF, however, this then also makes the form fields in the 'original' read only. 

 

Is there a way that when the user fills in the form, presses the submit form button, the e-mail attachment is read only but also keeps the original file fillable? 

 

Hope this makes sense. Thank you.

    Dieses Thema wurde für Antworten geschlossen.
    Beste Antwort von try67

    What you can do is use a script to set the fields as read-only before the submit command, then set them back as editable afterwards. Something like this:

     

    for (var i=0; i<this.numFields; i++) {
    	var fname = this.getNthFieldName(i);
    	var f = this.getField(fname);
    	if (f==null) continue;
    	f.readonly = true;
    }
    
    this.mailDoc({cTo: "me@server.com"});
    
    for (var i=0; i<this.numFields; i++) {
    	var fname = this.getNthFieldName(i);
    	var f = this.getField(fname);
    	if (f==null) continue;
    	f.readonly = false;
    }

     

    Note that this by no means prevents the contents of the fields from being edited. If you want to achieve that then the user will have to digitally sign the file before sending it, but then you won't be able to make the fields editable afterwards that easily...

    2 Antworten

    try67
    Community Expert
    try67Community ExpertAntwort
    Community Expert
    August 26, 2023

    What you can do is use a script to set the fields as read-only before the submit command, then set them back as editable afterwards. Something like this:

     

    for (var i=0; i<this.numFields; i++) {
    	var fname = this.getNthFieldName(i);
    	var f = this.getField(fname);
    	if (f==null) continue;
    	f.readonly = true;
    }
    
    this.mailDoc({cTo: "me@server.com"});
    
    for (var i=0; i<this.numFields; i++) {
    	var fname = this.getNthFieldName(i);
    	var f = this.getField(fname);
    	if (f==null) continue;
    	f.readonly = false;
    }

     

    Note that this by no means prevents the contents of the fields from being edited. If you want to achieve that then the user will have to digitally sign the file before sending it, but then you won't be able to make the fields editable afterwards that easily...

    ss97Autor
    Participating Frequently
    August 27, 2023

    Thank you so much. This works perfect, except there are certain fields in my form that are set as "Read Only" and once the submit form button is pressed those read only fields turn to visible. Is there a way to stop this from occuring? Also, is there a way to add in 2 CC e-mails + a subject line into this formula? Really appreciate your help.

    ss97Autor
    Participating Frequently
    August 28, 2023

    The fields it's happening to are text boxes with a formula "Simplified field notation" to calculate a figure based on another text box. E.g (textbox1*100.45)

    There are multiple text boxes calculating different figures depending on user input. Hope that makes sense.

    Also, thank you so much for the JS - you are a legend!


    Sorry, I have ran into another problem. My workplace uses a custom app to share/view docs. In the past I've usually set the Submit Form button properties to 1st Run a java script: 

    for (var i = 0 ; i < this.numFields ; i++) {
    var f = this.getField(this.getNthFieldName(i)) ;
    if (f.type != "button") {
    f.readonly = true ;
    }
    }

     

    Then a Submit Form action with mailto:1234@mail.com

     

    This has worked perfectly on the app.

     

    For some reason when I put this doc on the app (on an iphone/ipad) and press the submit form button, it opens the mail app fine but does not attach the doc to the email... 

     

    Is there a work around for this JS to include a "submit form action". As it seems it only works when i have a submit form action as well.

     

    So sorry for all the questions, once again thank you!!

    kglad
    Community Expert
    Community Expert
    August 26, 2023

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post if it helps you get responses.



    <"moved from using the community">
    ss97Autor
    Participating Frequently
    August 27, 2023

    My apologies, I didn't realise I had posted in the wrong place. Thank you for letting me know.