Skip to main content
Participant
September 23, 2024
Answered

How do I automatically n/a multiple fields on page 2 of a pdf, if "No" is selected on page one?

  • September 23, 2024
  • 3 replies
  • 375 views

I have a two page form that requires n/a in blank fields if No is selected on page 1, page 2 fields should all automatically n/a.  Thank you in advance.

This topic has been closed for replies.
Correct answer Nesa Nurani

Run this script as 'Mouse Up' action of checkbox "No":

var checkNO = event.target.value == "No";

for (var i = 0; i < this.numFields; i++) {
 var fieldName = this.getNthFieldName(i);
 var field = this.getField(fieldName);

 if (field.page === 1) {
  if (field.type === "text") {
   field.value = checkNO ? "N/A" : "";}}}

 

If you uncheck the 'No' checkbox through other means, you can modify the script to be used in a custom calculation script to set the fields to blank, if desired.

3 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
September 23, 2024

Run this script as 'Mouse Up' action of checkbox "No":

var checkNO = event.target.value == "No";

for (var i = 0; i < this.numFields; i++) {
 var fieldName = this.getNthFieldName(i);
 var field = this.getField(fieldName);

 if (field.page === 1) {
  if (field.type === "text") {
   field.value = checkNO ? "N/A" : "";}}}

 

If you uncheck the 'No' checkbox through other means, you can modify the script to be used in a custom calculation script to set the fields to blank, if desired.

dawn_7610Author
Participant
September 23, 2024

Hi, its a check box field.

 

 

try67
Community Expert
Community Expert
September 23, 2024

Selected where? In a drop-down field? Radio-button/check-box group? Something else?