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

Force selection of drop down

Explorer ,
Jul 06, 2017 Jul 06, 2017

Copy link to clipboard

Copied

Is there a way to force user to make a selection from a drop down before allowing them to move on to the next field?  Like it lights up red if selection not made?  I know in TurboTax, it won't let me do anything if I don't make a choice.  I want the field box to turn red and then an asterisk to come up telling user to make a selection.

I know how to do this by adding an app alert if the field is null but wanted to introduce a visual affect as well.

Thx.

Sue

TOPICS
Acrobat SDK and JavaScript , Windows

Views

520

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 06, 2017 Jul 06, 2017

Copy link to clipboard

Copied

Trying to clarify...

If the user enters the dropdown field you want them to...

A) not be able to exit until they make a selection or

B) you want to allow them to exit but change the appearance of the dropdown field to indicate a value is required.

If A, you don't need B.

If B, you don't actually want A.

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
Explorer ,
Jul 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

Hi,

I guess A is the most simple so A.

I tried the following after the user clicks the okay button but nothing happens:

if ("ok" == cRtn)

{

      if (global.docNumAction.strExmp == null) //Ensure the document type is selected

      {

      app.alert (("Please select document type"))

      }

}

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
Explorer ,
Jul 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

I even tried adding .value but it seems it won't recognize a null value.  What am I doing wrong?  I want it to generate an app alert when there is no value in the strExmp field which starts of as "" and gets populated by drop down (if selected).  I want it notice thatno value was chosen from the drop down list and to alert the user.

   

if ("ok" == cRtn)

{

      if (global.docNumAction.strExmp.value == null) //Ensure the document type is selected

      {

      app.alert (("Please select document type. This field cannot be blank"))

      }

}

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 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

What is the name of drop down field?

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
Explorer ,
Jul 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

The drop down field is named:

"LTyp": function(dialog)

        {

            var oRslt = dialog.store();

            var path = [];

            var cSel = ((this.GetListSel(oRslt["LTyp"],path))?path.reverse():"").toString();

            var oLabInfo = this.oDocNumParams[cSel];

         

            ...

         

        },

I just tried with LTyp == null and oLabInfo == null and no effect.

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
Explorer ,
Jul 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

Here's more:       

                                       {

                                            type: "view",

                                            align_children: "align_top",

                                            elements:

                                            [

                                              {

                                                    type: "static_text",

                                                    item_id: "sta3",

                                                    name: "1. Select Document Type:",

                                                },

                                                {

                                                    type: "popup",

                                                    item_id: "LTyp",

                                                    variable_Name: "strLTyp",

                                                    width: 93,

                                                    height: 23,

                                                    char_width: 8,

                                                },

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
Explorer ,
Jul 07, 2017 Jul 07, 2017

Copy link to clipboard

Copied

LATEST

I am getting closer but now I am getting an app alert no matter if the drop down list has a selection or not.  I want it to only give me this error if the user has not made a selection from the drop down.  Any suggestions are welcome.

"LTyp": function(dialog)

        {

            var oRslt = dialog.store();

            var path = [];

            var cSel = ((this.GetListSel(oRslt["LTyp"],path))?path.reverse():"").toString();

            var oLabInfo = this.oDocNumParams[cSel];

            ...

          },

if ("ok" == cRtn)

{

       if(this.LTyp == null)  //Ensure the document type is selected

      {

      app.alert("Please select 'Document Type'. This field cannot be blank.")

      app.execDialog(global.DocNumAction);

      }

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