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

Reset does not clear required element from fields

New Here ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

My form includes check boxes, and when a box is checked, it makes another field (calendar) required. The Reset clears all entries from the form, but the calendar filed remains required. This is my code in the check box:

Run JavaScript

this.getField("Text6").required=event.target.value!="Off";

 

The format for the calendar field is mm/dd/yy.

 

The Reset button has all elements selected.

 

What am I doing wrong?

TOPICS
PDF forms

Views

627

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 , Jul 09, 2021 Jul 09, 2021

The Reset Form command actually does trigger some scripts, namely all of the calculation scripts in the file.

So in order to cause it to clear the required property, move the code to the calculation script of the text field and change it to:

 

event.target.required=(this.getField("Check Box1").value!="Off");

 

Votes

Translate

Translate
Community Expert ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

The Reset button doesn't execute scripts.

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
LEGEND ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

Reset sets each field back to its default value - that is the info given as a default. There is no default visibility, default required etc. - if you change these it is permanent.

 

You can provide a button marked reset which runs a Reset forms action then runs some further scripts to do more resetting to your needs.

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 ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

The Reset Form command actually does trigger some scripts, namely all of the calculation scripts in the file.

So in order to cause it to clear the required property, move the code to the calculation script of the text field and change it to:

 

event.target.required=(this.getField("Check Box1").value!="Off");

 

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
New Here ,
Jul 19, 2021 Jul 19, 2021

Copy link to clipboard

Copied

LATEST

try67, thank you! Your answer did the trick.

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