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

Reset a field upon a change in the dropdown

Community Beginner ,
Nov 22, 2022 Nov 22, 2022

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
951
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 Beginner ,
Dec 03, 2022 Dec 03, 2022
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");}

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 ,
Nov 22, 2022 Nov 22, 2022

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

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

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");

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

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

this.resetForm(["f2"]);

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 Beginner ,
Dec 03, 2022 Dec 03, 2022
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");}

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