Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to particially flatten a form in Adobe Acrobat DC

New Here ,
Oct 11, 2018 Oct 11, 2018

I managed to flatten a form (javascript) with a Submit button. The submit button contains both javascript for flattening and submitting form via email.

This form needs to be locked when submitted by the employees but there are partially section meant for HR use. This HR use must not be flattened and HR should be able to fill this part.

Hence, how do I do this?

Note: Employees most likely to use Adobe reader

TOPICS
PDF forms
4.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Oct 14, 2018 Oct 14, 2018

You can use this script to do it:

var fields = ["Field1", "Field2", "Field3"]; // replace with actual field names

for (var i in fields) {

    var f = this.getField(fields);

    if (f==null) {

        console.println("ERROR! Can't find: " + fields);

        continue;

    }

    f.readonly = true;

}

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 11, 2018 Oct 11, 2018

If any users will not be using Acrobat and instead be using Reader, then flattening won't be an option. The closest you can come with Reader is to set certain fields to read-only or lock the entire form by digitally signing. E-signing with Adobe Sign will flatten the entire document, so you can't use it to exclude certain fields when flattening.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 11, 2018 Oct 11, 2018

I'm sorry I don't really understand. So I can't lock some fields and left others fillable by HR is it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2018 Oct 12, 2018

You can set them as read-only. It's not exactly "locking"...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 12, 2018 Oct 12, 2018

Understood. So how do I make them partially read-only when viewed by HR? And HR also get to fill the fields meant for them?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2018 Oct 14, 2018

You can use this script to do it:

var fields = ["Field1", "Field2", "Field3"]; // replace with actual field names

for (var i in fields) {

    var f = this.getField(fields);

    if (f==null) {

        console.println("ERROR! Can't find: " + fields);

        continue;

    }

    f.readonly = true;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2020 May 11, 2020

Hi!

 

I know this post is old but I am in the same situation, trying out the script but it doesn't work!

when I add

var fields = ["Field1", "Field2", "Field3"]; I used my field names, it doesn't work!

If I try it without the [] and just one field, it works. How come it doesnt work with multiple fields?

 

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2020 May 11, 2020

You can use this:

var fields = ["Field1", "Field2", "Field3"]; // replace with actual field names

for (var i in fields) {

    var f = this.getField(fields[i]);

    if (f==null) {

        console.println("ERROR! Can't find: " + fields[i]);

        continue;

    }

    f.readonly = true;

}

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2020 May 11, 2020
LATEST

Thanks Bernd. Just realized that my problem was the super quotes!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines