Radio button if then statement
Copy link to clipboard
Copied
Hi,
I am creating a PDF form that consists a questionnaire to fill out by the participants.
My questionnaire consists of 4 parameter: Always, Mostly Yes, Hardly Ever, Never
I am trying to assign a value for when one radio button or another is clicked.
I Would like to create a statement which says that if the radio button for Always or Mostly Yes is checked, then the value will be 1 (value will be seen in a different table) , or esle, the value will be none ("").
Since I want the radio buttons, the name must be the same which then makes it difficult for me to relate to the export values of each radio button.
Sorry I am new to javascript and writing codes.. would really appriciate the assitance.
Thank you!
Copy link to clipboard
Copied
So let's say you have a radio-button group called "Q1" with these four texts as the export values of each field in the group. As the custom calculation script of the text field where you want to show the result enter the following code:
var v = this.getField("Q1").valueAsString;
event.value = (v=="Always" || v=="Mostly Yes") ? 1 : "";

