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

Custom action for radio button selection help!

New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

I need help with creating a custom action in Prepare Form. 

I have 2 groups - Group A and Group B 

Group A has 5 choices 

Group B has 3 choices 

 

These two groups are assosciated to one another, and only one selection can be made in each group 

 

However - in group B - one of the choices can only work with one of the choices from group A and if selected it needs to restrict the the 4 choices from group A  that are incompatible - or ideally the action would automatically select the only radio button choice from Group A when the "restrictive" radio button is selected from Group B.  


I've gotten close by using the hide fields - and tried the "matching name auto selection" - but this feels like a custom action solution... ANY advice would be greately appreciated - or a bump to a similar post ~

 

Thank you! 

TOPICS
Create PDFs , JavaScript , PDF forms

Views

51

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

correct answers 1 Correct answer

Community Expert , Aug 18, 2022 Aug 18, 2022

You can set Group A to read only once you select choice from Group B.

Example: let's say you select "Choice3" from Group B and you want "Choice3" in Group A to be selected and then set Group A to read only so other choices can't be selected. As Mouse UP action of Group B "Choice3" radio button use this:

if(event.target.value == "Choice3"){
this.getField("Group A").value = "Choice3";
this.getField("Group A").readonly = true;}

 

You would need an option to make Group A selectable again, so instead o

...

Likes

Translate

Translate
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

You can set Group A to read only once you select choice from Group B.

Example: let's say you select "Choice3" from Group B and you want "Choice3" in Group A to be selected and then set Group A to read only so other choices can't be selected. As Mouse UP action of Group B "Choice3" radio button use this:

if(event.target.value == "Choice3"){
this.getField("Group A").value = "Choice3";
this.getField("Group A").readonly = true;}

 

You would need an option to make Group A selectable again, so instead of making multiple scripts for each button, I suggest you write all combination you want to happen and make script in hidden text field as calculation.

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
New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

Thank you so much! So very helpful and insightful - 

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
New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

I have an additional question to follow up with this topic... When the pdf is being filled out on a different reader - such as preview, explorer, safari etc. anything except Adobe Acrobat - the custom action rule doesnt seem to persist... is there something i'm missing in the finalizing the form and saving it? or is this type of rule only functional within the Adobe realm? thanks again! 

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
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

LATEST

Scripts in a PDF will only work with PDF viewers that execute scripts.  Unfortunately this is a small set of PDF viewers. And in particular the browser based viewers don't necessarily follow the PDF specification. Filling a form in such a viewer can damage the PDF document. As for mobile PDF viewers, most do not implement scripting, and the ones that do only impliment a subset of complete Acrobat model. The script Nesa provided should work in both the Acrobat Mobile Reader and Readdle PDF Expert. 

 

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