7 Replies Latest reply on Jul 7, 2017 1:01 PM by sargums46564804

    Force selection of drop down

    sargums46564804 Level 1

      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

        • 1. Re: Force selection of drop down
          Joel_Geraci Adobe Community Professional

          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.

          • 2. Re: Force selection of drop down
            sargums46564804 Level 1

            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"))

                  }

            }

            • 3. Re: Force selection of drop down
              sargums46564804 Level 1

              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"))

                    }

              }

               

              • 4. Re: Force selection of drop down
                Bernd Alheit Adobe Community Professional & MVP

                What is the name of drop down field?

                • 5. Re: Force selection of drop down
                  sargums46564804 Level 1

                  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.

                  • 6. Re: Force selection of drop down
                    sargums46564804 Level 1

                    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,

                                                                    },

                    • 7. Re: Force selection of drop down
                      sargums46564804 Level 1

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

                            }