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

Reset a field upon a change in the dropdown

Community Beginner ,
Nov 22, 2022 Nov 22, 2022

Copy link to clipboard

Copied

I have a dropdown field named f1

And a date field named f2

 

f2 needs to reset onchange of f1 to any of option values.

Any pointers?

TOPICS
JavaScript , PDF forms

Views

629

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 Beginner , Dec 03, 2022 Dec 03, 2022

I figured out the answer by reading the documentation:

In the validation script of f1, the following script did the job.

if (event.rc) {this.resetForm("f2");}

Votes

Translate

Translate
Community Expert ,
Nov 22, 2022 Nov 22, 2022

Copy link to clipboard

Copied

It should reset to what? Can you describe the process exactly how it should work?

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
Community Beginner ,
Dec 03, 2022 Dec 03, 2022

Copy link to clipboard

Copied

It can reset to empty.

Let me explain a scenario.

The dropdown field f1 has a selected value (lets say "Option 1") and the date field f2 has a date value in it.

Now, if we change the dropdown value to Option 1 or Option 2 or any dropdown option, by a mouse event, or a keyboard event, f2 should reset to null like this.resetForm("f2");

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
Community Expert ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

As the custom validation script of "f1" enter the following:

this.resetForm(["f2"]);

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
Community Beginner ,
Dec 03, 2022 Dec 03, 2022

Copy link to clipboard

Copied

LATEST

I figured out the answer by reading the documentation:

In the validation script of f1, the following script did the job.

if (event.rc) {this.resetForm("f2");}

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