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 enable , Use to capture client side event
netsnaveen
I am trying to use FormAPIs and havent been successful yet.
I have set enable_formapi=true in iw.cfg and have restarted the iwserver.
My goal is to call an inline perl script based on client side event onItemChange once I read the value selected from list box.
And have tried to use all the ways mentioned in the documents.
My DCR goes as follows:
____________________________________
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datacapture SYSTEM "datacapture5.0.dtd">
<data-capture-requirements type="content" name="Phonenumbers">
<ruleset name="Phone numbers">
<description>
Use this DCT to enter content for Product Promotion
</description>
<item name="Country">
<label>Country</label>
<description>Choose the country</description>
<select required="t">
<inline command="/server/teamsite/iw-home/iw-perl/bin/iwperl /server/teamsite/iw-home/iw-perl/bin/phonesctry.pl" />
</select>
<database data-type="VARCHAR(100)" />
</item>
<script language='javascript'>
<![CDATA[
function init() {
IWDatacapture.displayMessage("Retrieving locations in ");
IWDatacapture.redraw();
IWEventRegistry.addItemHandler('/Country', 'onItemChange', printVal);
}
function printVal(item)
{
alert("Retrieving locations in");
IWDatacapture.displayMessage("Retrieving locations in");
IWDatacapture.redraw();
}
init();
]]>
</script>
</ruleset>
</data-capture-requirements>
____________________________________
If I get this working, I will then need to call a perl script and pass the value that is selected from the list box and do the required processing. As U see I am trying to capture a user event as in client side Scripting.
Hope there are developers who have done this successfully already. I would appreciate if you can share the ways of doing it.
Environment i am working on : Solaris OS, TS 5.5.2
SP 4 installed.
Find more posts tagged with
Comments
pflory
Have you taken a look at the FormAPI templating examples Interwoven ships?
You can find them at:
iw-home/examples/Templating/templatedata/userscript
These should provide you a kickstart. If not, let us know.
Regards,
Paul
Paul Flory
netsnaveen
HI Paul,
I did see the examples and all 4 of them. And my sample code which I have posted it based on these examples. My issue is I would like to know if FormAPI is working fine on my env or not. How do I test if its working fine. I would be happy if I can see an alert() being triggered as soon as I change selection from the list.
Any pointers would be appreciated.
Thanks,
Naveen.
demo.JPG
pflory
From what you've written, I can't tell whether the issue is determining if FormAPI is working at all, or just the onChange trigger is causing heart-burn.
For the latter, check out this example -- it does what you've described you'd like to do:
iw-home\examples\Templating\templatedata\userscript\location\datacapture.cfg
You could alter that code by placing an alert() in the init function to see if the code is even being accessed. If FormAPI does not seem to be working at all, you may need to run an iwreset (?).
Paul
Paul Flory
netsnaveen
Hi Paul,
As you have rightly pointed out, its only the onItemChange trigger doesnt seem to call the actual function it needs to call. So is it a know IWOV issue or is there a tweek to it. Really appreciate your help.
Added the alerts as you mentioned and I see the alerts get called on form load.
Thanks,
Naveen.
Michael
Hi Naveen,
I don't know if this will fix your problem, but it may help. You are calling a redraw() in your init function.
As a general practice you shoudn't need to call redraw during init as the screen hasn't been drawn yet.
I would try removing it and see if this helps.
Cheers
Michael