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)
FORM API / Java script Error
System
Hi.
Env Win 2k with TS 6.5
i have the follwoing code of FormAPI which is working perfectly on TS 6.5 but when i am trying on TS 6.1 it fails due to many different errors. can someone Address this , where is the problem.
function init(){
IWEventRegistry.addItemHandler("/sub/paragraph","onItemChange",handle_para_change);
}
function handle_para_change() {
var summaryWordCount = 0;
var summaryDesiredWords = 3;
var summaryText="";
var paraParent = IWDatacapture.getItem("/sub");
var paras = paraParent.getChildren();
var paraCount = paras.length;
alert ("Total number of paragraphs:" + paraCount);
for (j=1; j<=paraCount; j++)
{
alert ("value of j : " + j);
paraItem = IWDatacapture.getItem("/sub[" + j + "]/paragraph");
paraText = paraItem.getValue();
alert("Para Text is: " + paraText );
if (( summaryWordCount == summaryDesiredWords) || (paraText==""))
{
alert ("Either Word Count " + summaryDesiredWords + " or No text in the Para..breaking");
break;
}
var summaryTextArray = paraText.match(/\w+/g);
alert("Summary text is:" + summaryTextArray);
for(i=0; ((i<summaryTextArray.length) && (summaryWordCount<summaryDesiredWords)); ++summaryWordCount, i++)
{
alert ("summaryWordCount : " + summaryWordCount);
summaryText = summaryText + " " + summaryTextArray
;
alert("summaryTextArray[" + i + "] = " + summaryTextArray
);
}
alert ("summaryText :" + summaryText);
}
alert ("setting summaryText as:" + summaryText);
summaryItem = IWDatacapture.getItem("/summary");
summaryItem.setValue(summaryText);
}
IWEventRegistry.addFormHandler("onFormInit",init);
I gone through the FormAPI TS 5.5.2 and 6.1. all the functions which i used in my code is available in API.
Thanks
RG
Find more posts tagged with
Comments
jbonifaci
Don't really have time to look at it right now, but listing some of the errors you are getting will probably help others help you.
shanon
which alert messages are you seeing, if any? ie. where is the code failing?
Shanon Levenherz
Mercer eBusiness Team
shanon.levenherz@mercer.com
http://www.mercerhr.com
Migrateduser
i am getting " null is null or not an object."
Not sure if this could be the version incompatibility of formAPI.
Migrateduser
Hi.
Not getting even the first alert.
seems prob around getChildren / getItem();
Thanks
RG
TEST_DATA.txt
Michael
I would suggest putting alerts in earlier on and then working out exactly where your code is failing.
btw the method sig for an onItemChanged handler normally includes a parameter for the triggering item.
Cheers
Michael