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

Auto insert text, into a text box, via a Radio Button selection

New Here ,
Aug 01, 2016 Aug 01, 2016

Hi all,

I am entirely new to working with Adobe Acrobat Pro DC, actually, I'm new to working with Adobe period. I've also taken on the task at work to turn a bunch of Word documents into fillable pdf documents. Through online tutorials, trial & error, and YouTube videos, I have become accustomed to some of the basics in preparing and editing pdf documents.

What I am finding far more challenging is where to locate tutorials on how one adds java script commands to a form. Is there somewhere I can learn how to add JavaScript to, say, a radio button? I can locate the 'Run a JavaScript' on the Radio Button Properties Action tab but beyond that, there is not much out there.

My ultimate desire is to be able to have a line of text auto insert into a text box (APC Results) after radio button (WI_0) is selected. If someone could write the code for this, it would be much appreciated but above that, I would love to learn how JavaScript is used within a form.

Thank you for your time,

BobbyD

TOPICS
Acrobat SDK and JavaScript , Windows
2.9K
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 , Aug 02, 2016 Aug 02, 2016

OK, in that case you can use the MouseUp event of the radio-button fields with this code:

if (event.target.value=="in spec") this.getField("APC Results").value = "See attached results";

Translate
Community Expert ,
Aug 02, 2016 Aug 02, 2016

If that radio-button is not selected, should the text field be editable by the user? If not, then you can simply use the custom calculation script of the text field. You just check the value of the radio-button group and apply the desired value to event.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 ,
Aug 02, 2016 Aug 02, 2016

Hi try67,

Unfortunately I didn't mention that the text field needs to remain editable. I have two radio buttons in one group. If the 'in spec' radio button is selected, I'd like a text box to autofill with 'see attached results' and if the 'out of spec' radio button is selected, then specific results need to be entered into that same text box.

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

OK, in that case you can use the MouseUp event of the radio-button fields with this code:

if (event.target.value=="in spec") this.getField("APC Results").value = "See attached results";

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

Thank you try67.

That worked swimmingly. All I had to do then, was add this to the out of spec radio button:

if (event.target.value=="Out of Spec") this.getField("APC Result").value = "";

Then I can manually place the out of spec results into that field.

Thank you again,

Bob

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