0 Replies Latest reply on Feb 27, 2014 9:55 AM by jason_clement

    Getting Selections from each Tab of a Script UI Tabbed Panel


      I am in the process of creating a script to import fields from any tab delimited file. Mainly for directories but at times we have other items. The number and names of fields are always changing so it has to be flexible. The user first selects the file, then selects the field names, and orders the field names. That all works. The next step is for the user to then select the formatting to go between each field. Which is where I run into a problem.


      The below is created from the array of the ordered field names, as you can see the creation of the box works fine. The tab names are the names of the field and they show up in the right order. However, no matter what I select on the other tabs my value is always defaulting to whatever the last selection (in this case the selection on the Streetname tab). What is really weird is I am getting the correct name of the tab but not the correct formatting for that tab- no matter what I've tried I get only the formatting for the last tab. I have gone through multiple rounds and numerous searches and can't seem to figure out what is wrong. Any help would be appreciated.

      Screen Shot 2014-02-27 at 11.39.25 AM.png


      //|||||||||||||||||||||||||||||||||||||||||||| function formatFields(finalList) ||||||||||||||||||||||||||||||||||||||||||||

      //From the selected headers arrange in the order they should be imported

      function formatFields(finalList){

          //set formatting variables for preview window

          var Pvw_space = "\u00A0"; //unicode space character for preview window

          var Pvw_tab = "\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0"; //unicode space characters simulating tab for preview window

          var Pvw_flb = "\n"; //forced line break for preview

          var Pvw_comma = "," + Pvw_space;

          var Pvw_string = "";

          var selForm=[];


          //create and populate tabbed window

          var FF_win = new Window ("dialog", "Select formatting for each field", undefined, {closeButton: false});

          FF_win.alignChildren = "right";

          var tpanel = FF_win.add ("tabbedpanel");

          tpanel.alignChildren = ["fill", "fill"];

          tpanel.preferredSize = [350,300];


          //create one tab for each field

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

              var tabName = finalList[i].toString();

              var general = tpanel.add ("tab", undefined, tabName,{name:tabName});

              general.alignChildren = "fill";



              var g_options = general.add ("panel", undefined, "Please select the formatting to follow this field");

              g_options.alignChildren = "left";

              g_options.tab = g_options.add ("radiobutton", undefined, "Tab");

                  g_options.tab.value = true;

              g_options.flb = g_options.add ("radiobutton", undefined, "Forced Line Break");  

              g_options.space = g_options.add ("radiobutton", undefined, "Space");           

              g_options.comma = g_options.add ("radiobutton", undefined, "Comma");






          //Preview and Cancel buttons

          var Confrimgrp = FF_win.add("group");


          var Prev_button = Confrimgrp.add("button",undefined,"Preview",{name:"ok"});

          var Back_button = Confrimgrp.add("button",undefined,"Back",{name:"cancel"});    

          //determine sorting of list

          Prev_button.onClick = function() {

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

                  with (FF_win.findElement(finalList[i].toString())){

                      if (g_options.tab.value == true){

                          alert (finalList[i].toString() + ": tab");


                      if (g_options.flb.value == true){

                          alert (finalList[i].toString() + ": FLB");                


                      if (g_options.space.value == true){

                          alert (finalList[i].toString() + ": space");                


                      if (g_options.comma.value == true){

                          alert (finalList[i].toString() + ": comma");                





          Back_button.onClick = function(){$.destroy();}


          //show dialog





          Back_button.onClick = function(){$.destroy();}


          //show dialog