Home
TeamSite
Limit on iwItem.setLabel
i8tweetybird
Is there a limit on the number of times you can invoke setLabel when you first initialize a form?
Here is my problem. I have a dct with 30+ items. When the dct is first opened, the labels for each of the items are in English. However, if the user changes his language preference on his browser, in the dct, i have a "onFormInit" that calls a callserver to a perl scripts that gets the users language preference and then goes to each label and changes them. Problem is that it only changes the first 5 labels and then stops. I tried switching them around to make sure it wasn't the label itself but same scenario, only the first 5 gets changed.
Maybe there is a better solution for doing this?!
Here is my piece of code from my perl script. It opens a file where I store the french labels. eg: /Content/Title_F;Titre where "/Content/Title_F" is the field name. Titre is the label.
#!D:\Interwoven\TeamSite/iw-perl/bin/iwperl
...
some code - check to see if language pref. is french. if not exit.
...
open(LBL, "y:\\default\\main\\-Shared\\WORKAREA\\UI_Components\\UserScripts\\Language\\fr-ca.txt") || die "can't open";
while () {
chop;
($field, $value) = split(/;/,$_);
print << END;
if (api.IWDatacapture.getItem("$field")){
api.IWDatacapture.getItem("$field").setLabel("$value");
}
END
}
close(LBL);
...
exit( 0 );
Thanks in advance.
Find more posts tagged with
Comments
i8tweetybird
Well, I have figured out what the problem is.
I have multiple containers in my dct. Each container appears on a page of it's own, as specified in my templating.cfg (items-per-page="1").
When I setLabel to any item on my first page, no problem. However, when I try to setLabel on a item other than the first page (or the first container), it sets the label for the first item and then returns a javascript null error, so the rest of the script fails. - which makes sense since that item is not displayed on the form.
My question now is, is there a way to setLabel to items on any other pages other than the first page when I first load the form?
i8tweetybird
Solved my problem.
I used the IWDatacapture.gotoPage() to go to the next page, set the labels on that page and so on...
Not sure if this is the best way of doing it, but it works. If you have a better way of doing it, please let me know.
chandeep
Is this possible in Teamsite 6.5
vahu
IWDatacapture.gotoPage() functionality has been in FormAPI since the release, which means TS 5.5.2.
IWItem.setLabel was not introduced until 6.7 :-(.
But I am sure on TS with FormApi you can achieve changing the label value my javascript/xhtml.
.Saya