Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Placing var Value into DCT field
System
In the following snippet - I'm correctly getting all my values
and forming a href the way I want. However, I'm now having one **** of a time trying to get the value of var pm into the DCT field whose item is pm - as you can see below the two commented out lines using getElementbyId didn't work - I thought that would be the winner - any suggestions would be great. Also - I'm kind of surprised that the value attritbute can't be used with the text tag?
Here's my js/form api code:
function init()
{
IWEventRegistry.addItemHandler("/misc", "onItemChange", selectedValue);
selectedValue(IWDatacapture.getItem("/misc"));
}
function selectedValue(item)
{
var typeItem = IWDatacapture.getItem("/misc");
var typeIndex = typeItem.getValue();
var myname = item.getOptions()[typeItem.getValue()].value;
var mytext = item.getOptions()[typeItem.getValue()].text;
var pm = "<a href ='/sc?bio="+myname+"'>"+mytext+"</a>";
//document.dcreditForm.pm.value = pm;
//document.getElementById('pm').value = pm;
window.alert(myname);
window.alert(pm);
IWDatacapture.redraw();
}
init();
Here is my simple DCT - two fields:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datacapture SYSTEM "datacapture5.0.dtd">
<data-capture-requirements type="content" name="testdct">
<!-- data-capture-requirements elements contain area elements -->
<ruleset name="test">
<description>
A product description
</description>
<item name="misc" rowcontinue="f">
<label>misc</label>
<description></description>
<inline command="d:/iw-home/Interwoven/TeamSite/iw-perl/bin/iwperl.exe d:/iw-home/Interwoven/TeamSite/httpd/iw-bin/inline_get_help_type.ipl"/>
</item>
<item name="pm">
<text required="t" size="40" />
</item>
<script language="javascript" location="template-type" src="shoescript.js"/>
</ruleset>
</data-capture-requirements>
Find more posts tagged with
Comments
Bubas_IWOV
Hi,
The way i would do it is like this:
function init()
{
IWEventRegistry.addItemHandler("/misc", "onItemChange", selectedValue);
}
function selectedValue()
{
var typeItem = IWDatacapture.getItem("/misc");
var typeIndex = typeItem.getValue();
var myname = item.getOptions()[typeItem.getValue()].value;
var mytext = item.getOptions()[typeItem.getValue()].text;
var pm = "<a href ='/sc?bio="+myname+"'>"+mytext+"</a>";
//document.dcreditForm.pm.value = pm;
//document.getElementById('pm').value = pm;
window.alert(myname);
window.alert(pm);
IWDatacapture.redraw();
}
init();
I may be wrong but give it a try.
Bruno
Migrateduser
Thanks - I had something very similiar to this - however - the only way I get the values is by passing them into the function - via the selectedValue(IWDatacapture.getItem("/misc")) line.
However - the values I can grab fine - it's just I want to place the a href which I've formed into my item text field which is called pm
Bubas_IWOV
Ok, got you now, so you want to setup the href inside of the item pm, sorry my mistake.
Try this inside of your function:
function init()
{
IWEventRegistry.addItemHandler("/misc", "onItemChange", selectedValue);
selectedValue(IWDatacapture.getItem("/misc"));
}
function selectedValue(item)
{
var typeItem = IWDatacapture.getItem("/misc");
var typeIndex = typeItem.getValue();
var typepm = IWDatacapture.getItem("/pm");
var myname = item.getOptions()[typeItem.getValue()].value;
var mytext = item.getOptions()[typeItem.getValue()].text;
var pm = "<a href ='/sc?bio="+myname+"'>"+mytext+"</a>";
//document.dcreditForm.pm.value = pm;
//document.getElementById('pm').value = pm;
window.alert(myname);
window.alert(pm);
typepm.setValue(pm);
IWDatacapture.redraw();
}
init();
This should do the job.
B
Migrateduser
Awesome - works like a charm! - by proof of concept is complete - now to move on and use the real-deal data and processes!
Thanks a million!
Bubas_IWOV
Glad i could help.
B