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

Set subsequent fields as "read only" to take data from first occurrence?

New Here ,
Feb 02, 2016 Feb 02, 2016

Hoping this can be easily done without the need for scripts.

I'm working on creating a proposal form. There are a few areas where I would like the first instance of a field to be editable but the rest would be locked so that they are even taken out of the tab order.

Example: On the front page I have a field for the company name. This field is repeated across the several pages of the proposal. Each field has the same name. As a result any data entered into any one of them is distributed to all of them.

Ideal Solution: Front page field is editable and is where the data is entered. All subsequent fields are set as "read only" and take their data from the "master" field" As a result, someone can't make a change to that form on, for example, the third page and have that error replicate out across the document.

Is this possible?

I'm using Acrobat Pro DC on Windows 7 pro.

Thanks.

TOPICS
Acrobat SDK and JavaScript , Windows
1.1K
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

correct answers 1 Correct answer

Community Expert , Feb 02, 2016 Feb 02, 2016

You have to use a script to do it, but it's a very simple one.

If the "master" field is called "Text1" then enter this code as the custom calculation script for all other fields that need to have its value:

event.value = this.getField("Text1").value;

Translate
Community Expert ,
Feb 02, 2016 Feb 02, 2016

You have to use a script to do it, but it's a very simple one.

If the "master" field is called "Text1" then enter this code as the custom calculation script for all other fields that need to have its value:

event.value = this.getField("Text1").value;

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 ,
Feb 02, 2016 Feb 02, 2016

Thanks for the quick feedback.

Where would I enter this script? I'm assuming in the Properties dialog box but not sure which tab.

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 ,
Feb 02, 2016 Feb 02, 2016

Properties - Calculation - Custom calculation script (the third option).

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 ,
Feb 02, 2016 Feb 02, 2016

Fantastic! 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
LEGEND ,
Feb 02, 2016 Feb 02, 2016

That script is likely sufficient in the majority of cases, but for all cases simply change it to:

event.value = this.getField("Text1").valueAsString;

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
Explorer ,
Mar 03, 2016 Mar 03, 2016

I have the same situation with a twist. My 6-page form has fields for a patient's name and the date on page 1.

I used the option to "copy across pages" for both fields. All good...enter the name & date on pages 1 and they show up on pages 2-6.

However, the name and date fields on pages 2-6 are still editable. In fact, if you edit the field (change the name or date) on page 6, it changes on pages 1-5 to the same entry.

I tried using the script above in the fields on pages 2-6, but the results are exactly the same as what I've described above. Actually, I entered the script on one page and it showed up on all pages in that field.

Will this only work if I create brand new name/date fields on pages 2-6?

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 ,
Mar 03, 2016 Mar 03, 2016
LATEST

You should change the field names for the fields on pages 2-6 so they don't match the ones on page 1. Also, set any fields that have a calculation script to read-only.

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