Home
TeamSite
TeamSite, LiveSite and OpenDeploy
Forms 71: update a container item from callout cgi
catorarn
I have a problem updating the current node in a container with a cgi callout value. I got it working for a hardcoded container item like this /article/iptc/iptc[2]/iptc-callout, and I got it working for all at once, however I cannot get it to update the current item as item is undefined in the callout ipl.
There surely is some way to do this... however I cannot find any reference implementation of this.
This is my code:
datacapture.cfg
[html]
dtd-system-identifier="C:\Interwoven\TeamSite\httpd\iw\article.dtd" name="Article">
<script language="javascript" location="template-type" src="article.js"/>
Iptc
Choose IPTC
[/html]
callout cgi ipl - javascript section
[html]
function set_datacapture_item_value( selectedValue )
{
if ((window.opener == null) ||
(window.opener.closed))
{
return false;
}
window.opener.focus();
window.opener.accumulate(selectedValue); //accumulate is a handler//
var calloutForm = eval($form_name);
if (!calloutForm)
{
return false;
}
var calloutElementFound = false;
for ( i = 0 ; i < calloutForm.elements.length ; i++ )
{
if (calloutForm.elements
.name == '$element_name')
{
calloutForm.elements
.value = selectedValue;
parent.getScriptFrame().accumulate(selectedValue); //accumulate is a handler//
calloutElementFound = true;
break;
}
}
if (!calloutElementFound)
{
return false;
}
return true;
}
function handle_selection()
{
var datacapture_item_value = "";
var datacapture_item_text = "";
var optionsArray = document.callout_form.selection_list2.options;
for ( i = 0 ; i < optionsArray.length ; i++ )
{
datacapture_item_value = datacapture_item_value + optionsArray
.value + "\\n";
datacapture_item_text = datacapture_item_text + optionsArray
.text + "\\n";
}
if (datacapture_item_value != "")
{
set_datacapture_item_value( datacapture_item_value);
opener.top.datacapture.refreshForm();
self.close();
}
else
{
alert('Please make a selection.');
}
}
[/html]
article.js
[html]
function init() {
// Register a function to change the DCR field iptc-callout based on the IPTC value in the calout jsp.
IWEventRegistry.addItemHandler("/article/iptc/iptc/iptc-callout","onCallout", handleCallout);
}
function accumulate(selectedValue)
{
//alert('the callout called this function');
var containerValue = "/article/iptc/iptc";
var count=0;
while (IWDatacapture.getItem(containerValue + "[" +(count+1) + "]")!=null)
{ count++;
alert("count=" + count);
}
if (count>0)
{
for(var i=1;i<=count;i++)
{
var item = IWDatacapture.getItem(containerValue + "[" +(i) + "]");
//alert("item=" + item);
var item_child = item.getChildren()[0];
//alert("IPTC Callout item_child=" + item_child);
//if current item equals item_child, then set value to selectedValue
item_value = item_child.getValue();
//alert("Z2 item_value=" + item_value);
}
//update the current iptc-callout value
if (item_value)
{
item_child.setValue(selectedValue);
}
}
}
[/html]
How should I approach this ?
Find more posts tagged with
Comments
There are no comments yet