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)
FormAPI, using item value in another item
pidi
I am a newbee for TeamSite Templating, read the FormAPI documentation and have a question about how to use the value of an item in another item.
this is part of the datacapture:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE datacapture SYSTEM "datacapture5.0.dtd">
<data-capture-requirements type="content" name="NotRelevant">
<ruleset name="Element">
<item name="Main_Part">
<label>Website categorie</label>
<description>
Selecteer de hoofdcategorie van de website
</description>
<select required="t">
<option value="01" label="Particulieren"/>
<option value="02" label="Ondernemers"/>
<option value="03" label="Vrije beroepen"/>
<option value="04" label="Over Fortis Bank"/>
</select>
</item>
I would like to set the value of another item on the same datacapture.
This is how the 'target-item' looks.
<item name="LinkFAQ">
<label>Link veel gestelde vragen</label>
<description>Selecteer hyperlink naar faq-categorie (indien
gewenst)</description>
<select>
<inline command="/opt/iw-home/iw-perl/bin/iwperl
/opt/iw-home/local/bin/fortisbanknl/oormerk.ipl
/generated/XML_VoorDatacaptures/faq<here goes the value of the item 'MainPart'>Categories"/>
</select>
</item>
Suppose the value of the first item is '01' then an inline command should be created and used as:
<inline command="/opt/iw-home/iw-perl/bin/iwperl
/opt/iw-home/local/bin/fortisbanknl/oormerk.ipl
/generated/XML_VoorDatacaptures/faq01Categories"/>
How do I do the trick?
Find more posts tagged with
Comments
Bill Klish
I don't believe this is possible. The inline commands are only processed as the datacapture.cfg file is loaded in your browser. Once the form has been loaded, there is no way to refresh or update your inline call.
This could be accomplished by using a FormAPI IWDatacapture.callServer(URL to your inline script). Your script would have to be accessible, but it would be possible to pass a parameter to a common script for the proper xml snippet to use (guessing that is what you want based on your example inline path).
Keep in mind that the callServer method is asynchronous. So, execution will continue within the Template before that call returns.
Migrateduser
You could also use FormAPI to trigger an event that would populate your drop-down list. To to this, though, you would need most or all of your inline logic to be in a Javascript function, if that's possible or feasible.
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP1 on W2K
(3) TS 5.5.2 SP2 on Win2K
pidi
Thanks for your reaction.
My reaction is a littje late, I was off for a few days.
In the datacapture I'able to capture the desired value (01, 02, 03 or 04 in this case) via a IWDatatcature.getItem
How am I going to pass this value to the callServer-command?
How should the callServer-command look like?
pidi
Thanks for your reaction.
I'll think over this solution. My knowledge of Javascript is very basic, but I have some people around here whom I can ask.
Adam Stoller
I believe the documentation for CallServer() shows how to pass information along - failing that - if you search these forums you should find some examples.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
tmp.zip