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

Clear field data dependent on checkbox YES or NO

Participant ,
Feb 27, 2024 Feb 27, 2024

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
364
Translate
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
1 ACCEPTED SOLUTION
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 = "";}

View solution in original post

Translate
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 ,
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 = "";}

Translate
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
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 = "";}
Translate
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