12 Replies Latest reply on Jan 18, 2016 8:49 AM by Unique

    Name to display as first in custom dialog popup list

    Unique

      Hi Forum.

       

      Thanks for the support so far.  I'm creating a simple custom dialog which will "popup", few names in dropdown.

       

      I'm reading an external txt file which will have the name matching to the dropdown list. i'm trying to display the matched name "Stephen" in the txt file as first and then other follows one by one. Please help on this.

       

      //name listed in popup

      dialog.load({

      names:

      {

      "King":-1,

      "Queen":-2,

      "Jack":-3,

      "Stephen":-4,

      "Robert":-5,

      }

      })

       

       

      //it tried as below but found the variable myList3 is directly listed instead of its value ("Stephen").

       

      dialog.load({

      names:

      {

      myList3 :+1,  // the variable myList3 will have the name "Stephen" stored in it.

      "King":-1,

      "Queen":-2,

      "Jack":-3,

      "Stephen":-4,

      "Robert":-5,

      }

      })

       

      Much appreciated your timely help on this. thank you.

        • 1. Re: Name to display as first in custom dialog popup list
          try67 MVP & Adobe Community Professional

          First of all, the id of an element in your dialog object must be exactly 4-characters. Not more, not less. So "names" is not a valid id value.

          • 2. Re: Name to display as first in custom dialog popup list
            Unique Level 1

            Hi try69... thanks for your support.


            Now i have changed it to "wkt2", please guide me further on my request...as i can't able to get the value stored in myList3.


            dialog.load({

            wkt2:

            {

            myList3 :+1,  // the variable myList3 will have the name "Stephen" stored in it.

            "King":-1,

            "Queen":-2,

            "Jack":-3,

            "Stephen":-4,

            "Robert":-5,

            }

            })

             

             

            Thank you very much.

            • 3. Re: Name to display as first in custom dialog popup list
              try67 MVP & Adobe Community Professional

              It's hard to help you further without seeing the full code, or at least the definition of myList3... I would suggest you go back to the first piece of code and change the value of "Stephen" to +4 (and the id value to a valid one). I think that should work. You can then use that to declare your list variable correctly.

               

              And it's try67, not try69...

              • 4. Re: Name to display as first in custom dialog popup list
                Unique Level 1

                Hi try67.. Sorry for the mistake. very sorry.

                 

                and below is the piece of code to display desired name as first...

                 

                // IMPORTING TXT FILE

                event.target.importDataObject("oFile", "/Users/rnarayanan/Desktop/123456789.txt");

                var qFile = event.target.getDataObjectContents("oFile");

                var cFile = util.stringFromStream(qFile, "utf-8");

                var ff = "";

                ff = cFile.split('\n');

                 

                // NAMES STORED IN Array "names" TO COMPARE WITH THE NAME IN TXT FILE

                var names = ["-", "King", "Queen","Jack","Stephen","Rober"];

                 

                 

                 

                GetTabDataB = app.trustedFunction (function()

                {

                   app.beginPriv();

                  

                var aData = ff;

                var oData = {};

                for(var i=0;i<aData.length;i++){

                 

                for(f in names)

                 

                 

                 

                //COMPARING THE NAME IN ARRAY WITH THE NAME IN TXT FILE

                  if(aData[i] == names[f]){ 

                  var myList4 = {};

                 

                //myList4[names[f]] = +4, //IF WE USE THIS PROCEDURE ONLY ONE NAME "STEPHEN" CAN DISPLAYED BUT THE OTHER NAMES ARE NOT DROPPING DOWN FOLLOWING "Stephen"


                //IF THE NAME IN TXT FILE MATCHES WITH THE NAME IN ARRAY THEN DISPLAY AS FIRST IN custom dialog popup.


                dialog.load({

                wkt2:

                {

                myList4:+4, // changed the value to +4 as suggested

                "King":-1,

                "Queen":-2,

                "Jack":-3,

                "Stephen":-4,

                "Robert":-5,

                }

                })

                }

                app.endPriv();

                }

                 

                 

                The below screenshot to show only the variable name is displayed instead of its value "Stephen".

                Screen Shot 2016-01-17 at 16.31.54.png

                 

                Please help me on this....very much appreciated your timely help on this.

                 

                thanks.

                • 5. Re: Name to display as first in custom dialog popup list
                  try67 MVP & Adobe Community Professional

                  You can either load an entire list of values using a variable, or you can load individual text strings, each one with an integer value, but you can't do both.

                  I don't understand from your code if myList4 is supposed to be a single value (eg. "Stephen") or a list of values...

                  • 6. Re: Name to display as first in custom dialog popup list
                    Unique Level 1

                    Hi try67,

                     

                    Thanks for your advice. Yes you are correct.

                     

                    Actually i tried with the below method to pass single text string to display.
                    myList4[names[f]] = 1,
                    dialog.load({"wkt2":myList4}); and the result is positive but as you said just only one string can be displayed or the all the strings as separate variables.

                     

                    Could you please advice me, if it's possible to check for the matching name in the dialog list items (below) comparing the text string (eg. "Stephen") in the imported data (txt file) and then displaying that as first in the popup and then followed by other names in the below dialogue list.


                    dialog.load({

                    wkt2:

                    {

                    myList4:+4, // changed the value to +4 as suggested

                    "King":-1,

                    "Queen":-2,

                    "Jack":-3,

                    "Robert":-4,

                    }

                    })

                     

                    Or ANY SAMPLE SCRIPT STEPS TO LOAD NAME OF THE DESIRED VALUE AS FIRST.......

                     

                    Thanks for your support and looking forward to help me .

                    • 7. Re: Name to display as first in custom dialog popup list
                      try67 MVP & Adobe Community Professional

                      Sorry, I'm not really following what you're asking me...

                      • 8. Re: Name to display as first in custom dialog popup list
                        Unique Level 1

                        HI try67.

                         

                        No probs... and very sorry for the messup.

                         

                         

                        Would it be possible to find the value (-1, -2 ,-3 etc.,) of the specific name (eg. "Stephen" : -4 ) in the below assigned listed order to display in dialogue when loaded and to change the value (-1 to +4) to display as a first item in dropdown list.

                        dialog.load({

                        wkt2:

                        {

                        "King":-1,

                        "Queen":-2,

                        "Jack":-3,

                        "Stephen":-4, // to check the value (-4) and change it to display as a first..... in the dialogue panel dropdown list

                        "Robert":-5,

                        }

                        })

                         

                        Again sorry for the confusion.

                         

                        Thanks.

                        • 9. Re: Name to display as first in custom dialog popup list
                          try67 MVP & Adobe Community Professional

                          Yes, change it from -4 to +4, as I said before... The selected item has a positive value. That's also how you identify it later when the dialog is committed.

                          • 10. Re: Name to display as first in custom dialog popup list
                            Unique Level 1

                            HI try67.

                             

                            Thanks for the immediate reply and patience.

                             

                            Any sample code to check the value of the assigned variable through scripting, because sources/links are available for only "forms and fields" but not for "custom dialog" dropdown values...

                             

                            thank you very much..... It's really a great support indeed from you.

                            • 11. Re: Name to display as first in custom dialog popup list
                              try67 MVP & Adobe Community Professional

                              Check out examples 3 and 4 in the API reference of execDialog.

                              • 12. Re: Name to display as first in custom dialog popup list
                                Unique Level 1

                                Hi try67.

                                 

                                Thanks for the info. Very helpful. Will try to find solution, otherwise need to seek for the support.

                                 

                                Thank you very much for your time.