I came across this function in the APEX 3.2 API Reference Guide (Part #E13369-01):
$v_PopupReturn(pValue, pThat)
Sets the value of the item in the parent window (pThat), with (pValue) and then
closes the popup window.
Return Value
Not applicable.
Parameters
pValue (string)
pThat (DOM node | string ID)
Looks perfect! In addition to passing the value back, it will also close the pop-up page, even though that is not documented.
On the pop-up page, I created a link with an Optional Redirect to URL, and put the following in the link:
javascript:$v_PopupReturn(#EMPNO#, '&P3_NODE.')
P3_NODE is the DOM ID of the tabular form item that I wanted to return the value to. You'll need to make sure that it's formatted properly for this to work. Thus, I am passing in a "1", but returning "f03_0001". A simple computation can do the trick.
Since we're using a built-in tabular form, we need to put the calling JavaScript in the Element Attributes of the item that we want the popup form to set. I used this:
onclick="popUp2('f?p=' + $v('pFlowId') + ':3:'
+ $v('pInstance') + '::::P3_NODE:#ROWNUM#',250,600);" readonly
This will pop open a new window, based on page 3 of my application. It will also grab the Application ID and Session ID from the DOM and use those in the link, so that we preserve our session state. Finally, it will pass along the corresponding ROWNUM of the item that we clicked on to the item P3_NODE - where I will make the proper transformation with the computation on Page 3. Lastly, the readonly option prevents users from making direct changes to the item.
Point taken from this - have a look at the APEX API guide before you embark on writing your own code. There are a number of helpful functions there than can save a lot of time and hassle.