4 Replies Latest reply on Aug 24, 2015 12:24 PM by satyai55913910

    how do you make a fill-able form non editable after distribution

    satyai55913910

      Hello,

      I am new to Adobe development. I have a requirement for a fill-able form. There is a Send Email Button at the bottom.

      Once user fills the form and clicks the send email button it will be dispatched to the email recipients mentioned in the Email Address column.

       

      The main requirement is - The recipients should not see (invisible) the Send Email Button at the bottom.

      And

      All the fields should be protected.

       

      Any help is appreciated.

      Thanks

      Satya

        • 1. Re: how do you make a fill-able form non editable after distribution
          Magus069 Level 4

          Hi there,

           

          to be able to do something like this you will need to create a script object preferably to have a function,

          the goal is to browse through the form to search for each fields in the form and set their access property to readOnly

          so the function need to be a recursive method which will search through each subforms / pages in your PDF

           

          So in LiveCycle Designer, you will need to modify the Submit button to send an email using the properties wanted,

          but before sending the email you will need to call this function

          //Param[0] #rootObject is to be the top most subform of every fields wanted to be set to read only

          function setAccessField(rootObject){

               //Verify if the object contains other objects(fields/subforms) and if the object is visible in the form

               if (rootObject.nodes.length > 0 && !rootObject.isPropertySpecified("presence") || (rootObject.isPropertySpecified("presence") && rootObject.presence == "visible")){

                    //Verify if the object is not a field, the idea is to search through subforms

                    if (rootObject.className != "field" && rootObject.className != "exclGroup"){

                         //Loop to look trough each objects in the subform

                         for (var i = 0; i < rootObject.nodes.length; i++){

                              //Calling back the function sending an object contained by a subform

                              setAccessField(rootObject.nodes.item(i));

                         }

                    } else {

                         //The object is a field or exclGroup(radioButtonList), set field readOnly

                         rootObject.access = "readOnly";

                    }

               }

          }

          and a way to send an email using an address filled within the form, you use this link for reference

          https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

           

          Hope this help!

          • 2. Re: how do you make a fill-able form non editable after distribution
            satyai55913910 Level 1

            Thanks a lot for immediate reply.Can you help me little bit more.As I am new to ADOBE development - Please help me how to1. create the script object2. how and where to place the function3. Where and how we call the function4. Then email the form to the recipients.

            ThanksSatya

            • 3. Re: how do you make a fill-able form non editable after distribution
              Magus069 Level 4

              Hi there again,

               

              Within LiveCycle Designer, to create a Script Object you need the Hierarchy Palette open.

              In the Hierarchy Palette right click on the top most subform (form1) and click Insert Script Object.

              Rename the Script Object for xfaSubmit, in that Script Object insert the function setAccessField() mentioned above.

              Instead of using the Submit button by default in LiveCycle Designer, use a normal button.

              This won't be acting as a validating button, so if you want to validate your form before submitting the form you will have to create your own validation..

               

              In the button, you will have to call the setAccessField() function like this

              //Page1  is the page that holds all the fields you want to set to read only

              xfaSubmit.setAccessField(Page1);

              then, once this is done you will want to send the email using the reference I sent you, you will have to put this code below the setAccessField() function in the submit button you have created

              it should look like this:

              // This is the form return email. It's hardcoded

              // so that the form is always returned to the same address.

              // Change address on your form to match the code below

              var cToAddr = txtEmail.rawValue;//Here make sure to set the field you want to get the email from

               

              // First, get the client CC email address

              var cCCAddr = "";

               

              // Now get the beneficiary email only if it is filled out

              var cBenAddr = "";

               

              // Set the subject and body text for the email message

              var cSubjectLine = "Form X-1 returned from client";//Here put the Subject of the email

              var cBody = "Thank you for submitting your form.\n" + "Save the filled form attachment for your own records";//Here insert the content of the email

               

              // Send the entire PDF as a file attachment on an email

              this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, cSubject: cSubjectLine, cMsg: cBody});

              Hope this help!

              • 4. Re: how do you make a fill-able form non editable after distribution
                satyai55913910 Level 1

                Thanks a lot. I have implemented both - making the form read only and Sending the form as PDF document by email as an attachment.

                 

                I also made the Submit button invisible with an if condition by placing code on docReady event - button.presence = "invisible"

                 

                Thanks

                Satya