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)
FormAPI getChildren() on replicant returns null
System
If you have a replicant that allows zero instances, if the user does not create an instance of the replicant, getChildren() will return null. If you try to access the length property (to determine the number of instances), your code will fail. This can be pretty confusing if you have an onSave trigger that tries to do something to all of the instances - it won't save and may not even give an error message. So you have to first check that getChildren() does not return null before you check the length property.
if ( IWDatacapture.getItem( "/Replicant" ).getChildren() != null )
{
for( i = 0 ; i < IWDatacapture.getItem( "/Replicant" ).getChildren().length ; i++ )
{
// do your thing
}
}
Find more posts tagged with
Comments
There are no comments yet