Using radio buttons to auto default other selections

New Here ,
Feb 06, 2020 Feb 06, 2020

Copy link to clipboard

Copied

I'm trying to use radio buttons to select a "sample type". Upon selection, I want the form to default certain tests to that particular sample type.

buttons.jpg

 

 

For example, selecting PARTS would default the Salmonella, Campylobacter, and EB testing radio buttons on..

 

I'm fairly new to Acrobat and JS so any help or advise is greatly appreciated. I'm learning on the fly. Thank you in advance!

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

35

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Feb 06, 2020 Feb 06, 2020

Copy link to clipboard

Copied

LATEST

So the "Analysis Needed" elements are checkboxes? If they are radio buttons, then only one can be selected. I think you need to change this.

So you need to create a relationship between the "Sample Type" selection and the Analysis selections. Do this with an object, where the entries are the export values from the Sample Type radio buttons, and the values are an array of selections for analysis

 

var oSampleTypes = {"Parts":["Salmonella", "Campylobacter", "EB"], "Reuse Water":[...], etc};

 

Use this on a selection to set the Analysis check boxes. These names of these checkboxes must exactly match the names listed in the object defined above. An easy way to do this is to add a text field and put the script into the calculation for that text field. This text field is on used to run the script. It has no other purpose and should be hidden.

 

Here are some article that will help:

This one is for dropdowns, but the technique used is exactly what you need here:

https://acrobatusers.com/tutorials/change_another_field/

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

 

 

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

Likes

Translate

Translate

Report

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