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

Clear field data dependent on checkbox YES or NO

Participant ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

I have a question on a form with 2 checkboxes  (YES or NO)

Depending upon the checkbox, I would like a script that will clear all the data in 3 specific fields.

If YES is checked, the focus moves to the next field. (This already works)

If NO is checked, clear all data in the 3 fields. (This is what I'm looking for.)

TOPICS
Create PDFs , PDF , PDF forms

Views

102

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 , Feb 27, 2024 Feb 27, 2024

Use as 'Mouse UP' action of 'NO' checkbox and replace field names with your actual filed names:

if(event.target.isBoxChecked(0)){
this.getField("Field1").value = "";
this.getField("Field2").value = "";
this.getField("Field3").value = "";}

Votes

Translate

Translate
Community Expert ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

Use as 'Mouse UP' action of 'NO' checkbox and replace field names with your actual filed names:

if(event.target.isBoxChecked(0)){
this.getField("Field1").value = "";
this.getField("Field2").value = "";
this.getField("Field3").value = "";}

Votes

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
Participant ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

LATEST

Thanks again Nesa.

I modified your suggestion to:

if (event.target.value == "NO") {
this.getField("Tobacco_Packs_per_day").value = "";
this.getField("Tobacco_years_usage").value = "";
this.getField("Tobacco_Quit_Date").value = "";}

Votes

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