add popup message to currant script

Explorer ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

hi, i'm using bellow script with drop down field. what i want to do is, if select "SGD" in drop down, fields "EX" value should be empty. if select any other value in drop down, need to popup message "Please fill exchange rate". ps help me to edit bellow script. thanks in advance. thanks..

var sNewSel = event.value;

switch (sNewSel) {

  case "SGD":

    this.getField("EX").value = "";

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

114

Likes

translate

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

Most Valuable Participant , Mar 20, 2018 Mar 20, 2018
Add this if-condition before the alert:if (this.getField("EX").valueAsString=="")     app.alert("Please fill exchange rate");

Likes

translate

Translate

Translate
Most Valuable Participant ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

Add this to the switch statement:

default: app.alert("Please fill exchange rate");

Likes

translate

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
Explorer ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

hi, thanks a lot. can u pls give me the compete code inserting your code. thanks in advance.

Likes

translate

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
Most Valuable Participant ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

I forgot to mention that you also need to add a "break" command... Here's the full code:

var sNewSel = event.value;

switch (sNewSel) {

    case "SGD":

        this.getField("EX").value = "";

        break;

    default:

        app.alert("Please fill exchange rate");

}

Likes

translate

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
Explorer ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

thanks a lot & it's working perfectly.. i just want add another condition into it so pls help me.

if select anything other than "SGD" & field "EX" is empty then only need to popup that message.

if fields "EX" already available values then no need that popup massage. thanks..

Likes

translate

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
Most Valuable Participant ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

Add this if-condition before the alert:

if (this.getField("EX").valueAsString=="")

     app.alert("Please fill exchange rate");

Likes

translate

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
Explorer ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

thanks a lot & it's work perfectly..

Likes

translate

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