Hide text field on radio button for JSNewbie

New Here ,
Jun 06, 2018 Jun 06, 2018

Copy link to clipboard

Copied

Hello,

I have read several similar posts on various ways to do this, but I am still stuck. I am completely NEW to javascript. This is my first attempt!

I've tried to copy similar JS examples, but replace with my labels, but i must be doing it wrong somewhere.

I need to hide a text box based on a radio selection in two instances.

I am running Adobe DC Pro.

I have 2 radio buttons in a group with a text field box for each choice.

Radio buttons are named "Group3" with unique names "Choice1" & "Choice2".

Text field boxes are named "G3C1" and "G3C2"

Goal: If Choice1 is selected, then text box G3C2 becomes hidden. Or if choice 2 is selected, then G3C1 becomes hidden.

Can someone provide me with the exact JS for this?

Radio button Hide Function.JPG

Appreciate any help - Thank you

TOPICS
Acrobat SDK and JavaScript, Windows

Views

167

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

Adobe Community Professional , Jun 06, 2018 Jun 06, 2018
Create a hidden text field and set this code as its custom calculation script:var v = this.getField("Group3").valueAsString;this.getField("G3C1").display = (v=="Choice1") ? display.visible : display.hidden;this.getField("G3C2").display = (v=="Choice2") ? display.visible : display.hidden;

Likes

Translate

Translate
Adobe Community Professional ,
Jun 06, 2018 Jun 06, 2018

Copy link to clipboard

Copied

Create a hidden text field and set this code as its custom calculation script:

var v = this.getField("Group3").valueAsString;

this.getField("G3C1").display = (v=="Choice1") ? display.visible : display.hidden;

this.getField("G3C2").display = (v=="Choice2") ? display.visible : display.hidden;

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 ,
Jun 06, 2018 Jun 06, 2018

Copy link to clipboard

Copied

LATEST

Awesome! That works!

Thank you

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