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

Javascript code to reset dropdown box value depending

Guest
Dec 21, 2018 Dec 21, 2018

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
2.2K
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 ,
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;

}

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

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

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 ,
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;

}

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

Awesome! Works perfect. Thank you!

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

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