It seems either approach in your post should work.
Another approach IF the main window and editor are running from the same server, which they probably are:
- You could just use pgExecuteRemote to run pgTBObjSet() to send a user event to the main window with the data as the [value] parameter.
- The same can be done from the main window back to the editor.
- This approach eliminates the need for hidden fields and variables. Global variables are not good places to store data is raw form as they can be manipulated easily by prying eyes.
Example:
In editor window when user has entered requested information in a field called "myInfo" and now the information needs to be sent to the main window to a field called "userInfo":
pgExecuteRemote( "main", "tbfunction_pgTBObjSet", [ "userInfo", "user", data ], false );
To send information to populate the field "myInfo" in the editor window with "userInfo" in main window:
pgExecuteRemote( [name of target window], "tbfunction_pgTBObjSet", [ "myInfo", "user", data ], false );
The user event in each window would parse the data an needed to achieve the desired results.
NOTE: I using an array to send the parameters to pgTBObjSet(). This is really easy in an XML file as you just enter it very similar to what I've done above. To do this Actions system, you would need to define a temporary array to hold the parameters and send the Actions array instead.
Another approach to this may be to use session cookies created with createCookie(). This is no data size restrictions when using session cookies and they are automatically deleted when the browser window/tab is closed.
So in conclusion, rather than saying one way is better than another, you have multiple ways to accomplish the same thing and depending on you application, you can choose which one is most efficient.