Copy link to clipboard
Copied
I am wanting to use one of three radio buttons to change comments in another section of the form. The form is for an elevation certificate and the radio button options are construction drawing, under construction, and finished construction. At each stage there are different things needed in the comments section that deal with the stages of the EC. Is there a way to link the comments in the comments section with the radio button choices so I don't have to type them in each time?
OK, then you can use something like this as the custom calculation script of the comments text field:
var v = this.getField("form1[0].ec_Section_C_D[0].SectionC[0].C1[0].RadioButtonList[0]").valueAsString;
if (v=="1") event.value = "Text for construction drawing";
else if (v=="2") event.value = "Text for under construction";
else if (v=="3") event.value = "Text for finished construction";
else event.value = "";
Copy link to clipboard
Copied
Yes, if by comments you mean markup annotations. Just about every aspect of an annotation can be changed with a script.
Here's the JavaScript reference entry for annotations.
Copy link to clipboard
Copied
I think that you mean the value of a text field, not actual comments (ie, annotations).
If that's the case it's also possible, using a simple script. Please clarify what you mean, though.
Copy link to clipboard
Copied
On the form there is a box in which I have to type various comments based on the status of the elevation certificate. What I would like to do is have that area filled out with the comments for each stage and only show what is needed for the radio button that is checked.
Copy link to clipboard
Copied
Do you have Acrobat Professional? If so, put the PDF into "Prepare Form" mode. This will allow you to see and edit both the Radio buttons and the "comment area" if it is in fact a text field. In order to change this "comment area" with a script you need to know what kind of element it is and it's name.
Copy link to clipboard
Copied
The current name for the comments section is form1[0].ec_Section_G[0].SectionG[0].comments[0]
here is the tooltip for the section Comments (including type of equipment and location, per C2(e), if applicable)
it appears to be a text field
Copy link to clipboard
Copied
This kind of name is usually used in LiveCycle Designer forms. Is this what you have, or is it a "regular" Acrobat form?
Copy link to clipboard
Copied
It looks like a standard PDF from to me I have been Acrobat DC to edit it.
Copy link to clipboard
Copied
OK. What's the name of the radio-button group, and the values of each one of the choices in it?
Copy link to clipboard
Copied
This looks like a static LiveCycle form. But it could also be simple conversion from an LC form.
You need to make sure before attempting to make any edits.
Run this line of code in the Console window and tell us what is returns.
xfa
It's just this one word. It will tell you the type of form.
Copy link to clipboard
Copied
ReferenceError: xfa is not defined
1:Console:Exec
undefined
Copy link to clipboard
Copied
It's an Acrobat form, then.
Copy link to clipboard
Copied
The radio buttons are showing
form1[0].ec_Section_C_D[0].SectionC[0].C1[0].RadioButtonList[0]
Section C1 Radio Button Group
then under options the radio choice changes from 1 for construction drawing to 2 for the under construction and Finished construction
The form is a standard elevation certificate from FEMA that has been slowly modified to make it easier to deal with multiple homes and municipalities
Copy link to clipboard
Copied
OK, then you can use something like this as the custom calculation script of the comments text field:
var v = this.getField("form1[0].ec_Section_C_D[0].SectionC[0].C1[0].RadioButtonList[0]").valueAsString;
if (v=="1") event.value = "Text for construction drawing";
else if (v=="2") event.value = "Text for under construction";
else if (v=="3") event.value = "Text for finished construction";
else event.value = "";
Copy link to clipboard
Copied
Thank you that worked exactly as I needed. Now I just need to place the text on separate lines
var v = this.getField("form1[0].ec_Section_C_D[0].SectionC[0].C1[0].RadioButtonList[0]").valueAsString;
if (v=="1") event.value = "C2.a,d +e) Proposed Elevation" +
"*Per LOMR 19-06-0138A Effective Date: 10/18/18" +
"500 Year BFE = '" +
"Min FF = '";
else if (v=="2") event.value = "*Per LOMR 19-06-0138A Effective Date: 10/18/18" +
"500 Year BFE = '" +
"Min FF = '";
else if (v=="3") event.value = "C2.e) AC Pad" +
"*Per LOMR 19-06-0138A Effective Date: 10/18/18" +
"500 Year BFE = '";
else event.value = "";
so instead of C2.a,d +e) Proposed Elevation*Per LOMR 19-06-0138A Effective Date: 10/18/18500 Year BFE = 'Min FF = ' when I use construction drawing I need
C2.a,d +e) Proposed Elevation
*Per LOMR 19-06-0138A Effective Date: 10/18/18
500 Year BFE = '
Min FF = '
Copy link to clipboard
Copied
Insert "\n" into the strings at the spots where you want to add a line-break.
Copy link to clipboard
Copied
thank you I just figured it out as you answered. Kind of feeling a little slow on that one.