Environment: TS 7.3.2 on Linux
Scenario:
- My DCT [optionally] references another DCR (of a sepcific type) for some of its data. As such we have a 'browser' item for finding the DCR to reference.
- I would like to add two additional buttons for this item(*) to allow for either editing of an already selected DCR or creation of a new DCR of the same type.
- It's been a while since I've done this kind of thing, and while I have part of this enabled, there are still some issues I'm hoping to get some guidance on (pointers to documentation is fine, code snippets are obviously fine too :-)
Existing Code:
<!-- 1st Pass DCT snippet --><item name="ref_dcr" pathid="ref_dcr">
<browser initial-dir="..." ceiling-dir="..." extns=".xml">
<callout label="New"/>
</browser>
</item>
<!-- 2nd Pass DCT snippet (current) --><item name="ref_dcr" pathid="ref_dcr" rowcontinue="t">
<browser initial-dir="..." ceiling-dir="..." extns=".xml"/>
</item>
<item name="new_dcr" pathid="new_dcr" rowcontinue="t">
<hidden><callout label="New"/></hidden>
</item>
<item name="edit_dcr" pathid="edit_dcr">
<hidden><callout label="Edit"/></hidden>
</item>
// 1st pass FormAPI snippets
function init() {
...
IWEventRegistry.addItemHandler("/root/ref_dcr", "onCallout", newDCR);
...
}
function newDCR(item) {
var wa = IWDatacapture.getWorkarea();
var url = "/iw-cc/newform?vpath="+wa+"&iw_tdt=****/yyy" +
"&done_page=refresh_parent_and_close_window.html";
window.open(url, "New ****/yyy DCR");
}
// 2nd pass FormAPI snippets (current)
function init() {
...
IWEventRegistry.addItemHandler("/root/new_dcr", "onCallout", newDCR);
IWEventRegistry.addItemHandler("/root/edit_dcr", "onCallout", editDCR);
...
}
function newDCR(item) {
var dcrItem = IWDatacapture.getItem("/root/ref_dcr"); /* currently unused */
var wa = IWDatacapture.getWorkarea();
var url = "/iw-cc/newform?vpath="+wa+"&iw_tdt=****/yyy" +
"&done_page=refresh_parent_and_close_window.html";
window.open(url, "New DCR");
}
function editDCR(item) {
var dcr = IWDatacapture.getItem("/root/ref_dcr").getValue();
if (dcr.match(/^\s*$/)) {
alert("...");
return false;
}
var wa = IWDatacapture.getWorkarea();
var url = "/iw-cc/edit?vpath=" + wa + dcr +
"&done_page=refresh_parent_and_close_window.html";
window.open(url, "Edit DCR");
}
Issue / Query:
- On completing the creation of the new DCR, and clicking Finish the window closes. Great, but I want to get the rel-path/name of the new DCR and fill it into the field in the "main" DCT
- Once I have the information populating the field should be trivial, however I cannot recall how to get that information (and a quick glance at the UICG didn't seem to help)