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)
Container Values
annie_eow
Hi,
I have the following codes within the DCT:
<item name="BulletinDetails">
<replicant max="3">
<container name="DatesInfo">
<item name="Start Date" rowcontinue="t">
<text></text>
</item>
<item name="End Date" rowcontinue="f">
<text></text>
</item>
</container>
</replicant>
</item>
</item>
I need to perform validation check for Start Date and End Date using FormAPI upon saving the data. But I always get "Null object" message prompted.
This is how i code in the FormAPI script:
var startDateItem=IWDatacapture.getItem("/BulletinDetails/DatesInfo/Start Date");
var endDateItem=IWDatacapture.getItem("/BulletinDetails/DatesInfo/End Date");
alert(startDateItem);
alert(endDateItem);
Can anyone guide me whether the script is Ok to run? How can I retrieve the values from container...where as the container is within a replicant? I am new to FormAPI and hope to get some guidelines through this forum.
Thanks.
Find more posts tagged with
Comments
Migrateduser
In order to address the an individual item in the data capture form properly, you have to following the basic syntax for addressing in formAPI. The notation of FormAPI item addressing is similar to the W3C XPath Recommendation.
In order to refer to Start Date and End Date in the first element of the replicant, you have to the following:
var startDateItem=IWDatacapture.getItem("/BulletinDetails[0]/DatesInfo/Start Date");
var endDateItem=IWDatacapture.getItem("/BulletinDetails[0]/DatesInfo/End Date");
Please refer to formAPI document on your server. the URL is
http://YOURServerName/iw/help/tst/formapi
8496.pdf
LegendWrap.ssd.zip
annie_eow
Hi, I did put in the [0] for BulletinDetails and it managed to point to the correct dates. But when I started to use a for loop to locate the BulletinDetails replicants, it prompted error again.
Below is the script i used:
var bulletinLinks = new Array();
var bulletinItem = IWDatacapture.getItem("/BulletinDetails");
bulletinLinks = bulletinItem.getChildren();
for (var i = 0; i < bulletinItem.length; i++)
{
var startDateItem=IWDatacapture.getItem("/BulletinDetails["+ i +"]/DatesInfo/Start Date");
var endDateItem=IWDatacapture.getItem("/BulletinDetails["+ i +"]/DatesInfo/End Date");
......
....
}
It started prompting error when hitting the bulletinItem.length. Error message is "null is not an object".
Any idea why is the length for the replicants is not located?
Thank you.
Migrateduser
The "bulletinItem" is an IWItem object, it does not have the length method, you might want to try the bulletinLinks.length since it is an array and contains the number of children for BulletinDetails.