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

Display error message on checkbox if drop down selected

Engaged ,
Jan 10, 2020 Jan 10, 2020

I have a checkbox named 'NoLieu' and a dropdown list named 'AbsenceType'.  Is it possible to display an error message and/or disable the user from being able to check the box if the user selects from one of the options in the Absence Type dropdown list?  Even better, if an error message could also appear if the user checks the No Lieu box first and then selects an option from the Absence dropdown list too.  I don't want them to be able to check the 'No Lieu' box at all if they select an Absence Type option.

Thanks!

TOPICS
Acrobat SDK and JavaScript
858
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

correct answers 1 Correct answer

Community Expert , Jan 12, 2020 Jan 12, 2020

Hi,

 

In the custom calculation script of your dropdown field, you can use something like this:

 

var a = this.getField("No Lieu").value;
var b = this.getField("Absence Type").valueAsString;


if(a=="Off") event.value=b;
else if (a=="Yes") event.value="";
if ( (b!=="") && (a=="Yes") ) app.alert("PLEASE NOTE: Only one selection is allowed",0);
Translate
Community Expert ,
Jan 12, 2020 Jan 12, 2020

Hi,

 

In the custom calculation script of your dropdown field, you can use something like this:

 

var a = this.getField("No Lieu").value;
var b = this.getField("Absence Type").valueAsString;


if(a=="Off") event.value=b;
else if (a=="Yes") event.value="";
if ( (b!=="") && (a=="Yes") ) app.alert("PLEASE NOTE: Only one selection is allowed",0);
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
Engaged ,
Jan 13, 2020 Jan 13, 2020

Thank you so much!!  You are a gem!  It works like a charm 🙂

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 ,
Jan 13, 2020 Jan 13, 2020
LATEST

You're welcome. Happy to help.

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