Skip to main content
jasons35699793
Known Participant
April 26, 2019
Answered

Radio Button to change comments

  • April 26, 2019
  • 2 replies
  • 1467 views

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?

This topic has been closed for replies.
Correct answer try67

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


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 = "";

2 replies

try67
Community Expert
Community Expert
April 26, 2019

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.

jasons35699793
Known Participant
April 26, 2019

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.

Thom Parker
Community Expert
Community Expert
April 26, 2019

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.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Thom Parker
Community Expert
Community Expert
April 26, 2019

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.

Acrobat DC SDK Documentation

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often