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

Javascript code to reset dropdown box value depending

Guest
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

Hello,

I need javascript code to reset a dropdown box to the default value ("Make Selection") if the "No" radio button is checked and "Reconciliation" is selected in the dropdown box. The dropdown box values are "Make Selection, January, February, March, April, May, June, July, August, September, October, November, December, and Reconciliation". Also, need an error message stating "Please select a valid month" to pop up.

TOPICS
PDF forms

Views

1.8K

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 , Dec 21, 2018 Dec 21, 2018

Use this code as the custom validation script of the drop-down field:

if (this.getField("Full Year Reconciliation").valueAsString=="No" && event.value=="Reconciliation") {

     app.alert("Please select a valid month");

     event.rc = false;

}

Votes

Translate

Translate
Guest
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

The dropdown box name is "Month Reporting". The radio button name is "Full Year Reconciliation"

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 ,
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

Use this code as the custom validation script of the drop-down field:

if (this.getField("Full Year Reconciliation").valueAsString=="No" && event.value=="Reconciliation") {

     app.alert("Please select a valid month");

     event.rc = false;

}

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
Guest
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

Awesome! Works perfect. Thank you!

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
Guest
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

LATEST

What can I add to this validation script to bring the dropdown box to its default value if the "Yes" radio button is checked and "Reconciliation" is not selected in the dropdown box? Also, will need an error message to pop up stating "Please select "Reconciliation" in Month Reporting drop-down box".

Thanks!

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