Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Help with controlling list values displayed
jcopple
I need help!!
I am trying to control the list values displayed in the DCR, with the second list values based on the selection from the first list box.
Both list boxes are populated via an inline commands to separate ipl files.
The ipl files then each read in the required values from an XML file and use a substitution to return the values to the list boxes in the DCR.
The ipl for the first list box runs and returns the values selected from the XMl file.
I need to select a value from the first list, and then use that value in the second ipl file, to determine which XML file of values to use.
So far, I can get the value selected on the DCR using FormAPI but I have no way of passing it to the ipl file.
I also need to be able to refresh/re-run the second ipl file, when the value in the first list box changes, so that the values in the second list box reflect the change!!
Can anyone help me??
Find more posts tagged with
Comments
Adam Stoller
inline scripts run ONLY at the time that the DCT is rendered - to do what you want, you'd have to have to use FormAPI - or a callout - to populate the second field based on the selection in the first.
--fish
(Interwoven Senior Technical Consultant)
jcopple
I have some JavaScript in the DCR, to get the selected value but I'm trying to populate the list boxes without putting a button on the screen and I was using inline commands to call the ipl files, which read in the data from the XML files.
The list boxes are also a replicant item, within a container.
<script language="javascript">
<![CDATA[
var key_value="";
function init()
{
IWEventRegistry.addItemHandler("/Asset Info/info/cust_name",
"onItemChange", selectedValue);
selectedValue(IWDatacapture.getItem("/Asset Info/info/cust_name"));
}
function selectedValue(item)
{
var flag = item.getOptions()[item.getValue()].value != null;
var key = item.getOptions()[item.getValue()].value;
var name = item.getOptions()[item.getValue()].text;
key_value = key;
IWDatacapture.redraw();
}
init();
]]>
</script>
I can get the text and value of the selected item and set the value to the global variable.
What do I do next, if I want to then use the global variable value in the second ipl file, as a reference??
Thanks in advance!!
Edited by jcopple on 02/27/03 08:45 AM (server time).
Migrateduser
With an inline you are not going to be able to get one iota of dynamic ability. Using FormAPI will get you closer. The javascript can run when the form first appears.
From this you can gather any needed variables, and use FormAPI's call server to make a call to your ipl files. (Though you will have to transform them in to .cgis in order to receive the output.) The .cgi can then output javascript that will alter your template appropriately.
However, be warned that replicants can be somewhat problematic. (You don't have the easy ability to make new modifications when the user expands the replicant.)
jcopple
How do I transform an .ipl file to a .cgi?
One of the .ipl files attached.
Migrateduser
The formAPI docs (available at
https://support.interwoven.com/library/manuals/templating/html/formapi1.0/formapi_1.html
and on your local TeamSite server can guide you through some of the setup you need.
Basically, instead of returning a substitution string you will return some javascript that will update the form.
Thus instead of printing out the substitution code you will need to print something like:
Content-type:text/html
<script>
window.alert('hi there');
</script>
When form api runs code from 'callserver' it runs it in a hidden window, so it can be somewhat difficult to debug. This example will simply print an alert box. What you will probably want to do is use javascript code to manually alter the form based on information obtained. The formAPI callserver function can pass a javascript object to your cgi that can then be parsed using TeamSite::CGI_lite or CGI. (or by hand if you are adventurous)
A search for FormAPI on devnet will return a few articles with examples that may be useful.