[SOLVED] How to find the App Index for the current Form object


Hello Support.

If a few windows of the same class are opened then referencing elements in the window from Javascript means using something like ‘App.Window1[Index].SomeTextbox’. But how do I know the value of Index to use ? I have found that if a Window is originally ‘App.Window1[3]’, for example, and one of the other Window1 objects are closed then the window then becomes ‘App.Window1[2]’. Is there a property on the Form class that will give me the current index value for that object ?

Also, when the first object of Window1 is created in a session then fields in that window can be referenced from Javascript just as ‘App.Window1.SomeTextbox’. But after another Window1 is opened ‘App.Window1.SomeTextbox’ will give an error (because ‘App.Window1’ will be an array and something like ‘App.Window1[0].SomeTextbox’ will be required). How can I know whether I need to treat App.Window1 as an object or an array ? (is using ‘Object.prototype.toString.call(App.Window1)’ and seeing if it says it is an array or not a good way ?)

Thanks in advance.


  • You must to post comments
Best Answer

Hi Andrew,

basically there is no way way of knowing or relying on the index on the client.
If you create multiple instances of the same form class and then need to reference
it on the client in JavaScript you can either

a) give each instance a different name (the Name property) or
b) use “this” to refer to your instance when calling a script on the server

To check if a reference is an array in JavaScript either use Array,isArray() or test the length property !== undefined.

Hope that helps.

Best regards

  • Andrew Pearce
    Hello Frank. Thank you for answering my question, wisej is a great product with great support ! I have used your suggestion of giving each form a unique Name and this has solved my problem. Thanks again. Andrew.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.