1 Reply Latest reply on Jul 2, 2011 9:20 AM by K_Nep

    Variables and arrays global and local scoping issues


      First I am new to Javascript and especially so to Livecycle Javascript.


      I am trying to make a form where:


      1. There is a table in the Main Form. Through the use of buttons the user turns on the visibility of subforms on and off. (got this working)


           The subforms have check boxes which when selected will display the appropriate text in TextFields in the Table in subform0 (main page).


           I would like to define and initialize the Array once (hopefully) - when the page loads (my thinking!  in the form1.initialize section of scripting). This array would then be able to be accessed by and avaiable to several (about 6) subforms to get and put values into the main table in subform0.


      Any feedback on the scoping of variables would be appreciated. Where would I define these for a form? (Do I use File:Page properties: Variables tab? or do something else in the scripting section. Any other references where I could learn more on scoping in livecycle javascript?


      2.  I am also having trouble in learning how to access various instances of a textField. (eg TextField1[0], TextField1[1], TextField1[2], etc). This would allow me to loop through each of the instances because I can't use getFieldById in livecycle D ES.