get cascaded lists with different combination in Custom dialog boxes

Avatar

Avatar

PlanetSong

Avatar

PlanetSong

PlanetSong

04-08-2016

Adobe LiveCycle Designer Cookbooks by BR001: Using app.execDialog() in an Adobe Designer Form

1.PNG

I'm following the above post and trying to do this:

1.

When I select "Aland Islands", it need to show the cities of this island in a new list box that's appended to the first one. When I select any city listed, it shows the district accordingly in a third list box, like this:

Capture.jpg

(The above dialog box is created with excel visual basic.)

The above selection combination is random. When you select item 110--> item 1103, it may or may not show 11031, depending on the data given by the requirement document.

I've studied the code in the sample PDF. Now I can only achieve this stage: select item 110 --> item 1103, it shows 11031.

But I cannot think of  a better way to add some extra selection flow(eg. It can also browse through 120-->1204-->12043).

My code

function customDialogBox() {

    var dialogDescriptor = {

        "LST1": function(dialog) { // the first list

            var lst1 = dialog.store()["LST1"];

            for (var item in lst1) {

                if (lst1[item] > 0) {

                    var selectedValue1 = item;

                    break;

                }

            }

            if (dialogObject.selectedItem(lst1) == "110") { //when "110" in the first list is selected, it enables the display of list2

                dialog.visible({

                    LST2: true

                });

            } else {

                dialog.visible({

                    LST2: false

                });

                dialog.load({

                    "txt1": selectedValue1

                });

            }

        },

        "LST2": function(dialog) { // the second list

          //when "1103" in the second list is selected, it envisibles list3

        },

        "LST3": function(dialog) { // the third list

          //  concatenate and return the string selected in List1, List2, List3

        }

    };

    var dialogObject = {

        LST1: data.list1, //a map, storing the data in the first level

        LST2: data.list110,//a map, storing the data in the second level, when the parent code is 110

        LST3: data.list1103 //a map, storing the data in the third level, when the parent code is 1103

    }

}

Basically it's hardcoding the selection flow. I wish to dynamically generate the lists.

I'm thinking of storing all the lists and identify them by ID, perhaps in this way:

Header 1

      var dialogObject = {

              LST1: data.list1,

              LST110: data.list110,

              LST1103: data.list1103,

              LST120: data.list120,

              ......

          }

But how can I correctly identify them, in order to show/hide the lists, and finally output the concatenated string in function customDialogBox()?

Or perhaps there's a better solution to retrieve the list at runtime, please do enlighten me!

2. By the way, is it possible to do the search (search the code and highlight the result item) as shown in the picture above? Can you give me some  keyword I need to google with?

Big thanks!!!!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Magus069

MVP

Total Posts

1.0K

Likes

132

Correct Answer

150

Avatar

Magus069

MVP

Total Posts

1.0K

Likes

132

Correct Answer

150
Magus069
MVP

04-08-2016

It is possible to dynamically create objects and a full dialog, as well as data within json object..

What I mean by item ID is the item ID in your dialog, such as LST1, LST2, LST3... but it can't be LST10, length is too long, the dialog will not interpret the ID because of its length

What I mean for the right conditions in the initialize event, is when you will call the initialize event when the user select an item within the first list, you will have to make if statements with variables in behind to guide the behavior of the dialog to display the lists wanted as well as the data you specifically want to display.

Answers (2)

Answers (2)

Avatar

Avatar

PlanetSong

Avatar

PlanetSong

PlanetSong

04-08-2016

" item ID": I don't quite get you, what's the item ID that's 4 char? my data comes from this map:

var list = {"some string":-110,

  "some string":-120,

   ...

   }

"But if I understand well": Yes you are correct.

"put all the right conditions within the initialize event":

Oh, do you mean I indeed need to hardcode all of them:

initialize: function(dialog) {

            dialog.load({

              LST1: dialogObject.LST1,

              LST110: dialogObject.LST110,

              LST1103: dialogObject.LST1103,

              LST12: dialogObject.LST120,

              ......

            });

            dialog.visible({

                LST110: false,

                LST1103: false

                LST12: false

               .....

            });

        },  

"LST110": function(dialog) {

          //TODO

        },

"LST1103": function(dialog) {

          //TODO

        },

"LST12": function(dialog) {

          //TODO

        }

Avatar

Avatar

Magus069

MVP

Total Posts

1.0K

Likes

132

Correct Answer

150

Avatar

Magus069

MVP

Total Posts

1.0K

Likes

132

Correct Answer

150
Magus069
MVP

04-08-2016

Perhaps I don't really follow you on this one, but I can tell you that an item ID within a dialog box must be 4 characters length, not more, not less... otherwise it causes errors

But if I understand well, you'd like to have a second list box to display other items according to the selected item in the previous list.

If I'm not mistaken, to do so you must put all the right conditions within the initialize event to call the dialog.load() method... only on the initialize event you can modify the source items of a list without closing and re-opening the dialog.