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)
insert a new replicant instance
syim
In TeamSite 6.5, we can use IWItem.addInstance(index) to insert a replicant instance. What if the IWItem is null (no replicant has been inserted into the DCR yet). How are we going to refer to the IWItem that is null?
For example, we have a replicant in DCT as followings:
<item name="topic" min="0" max="unbounded" default="0" pathid="topic">
<text/>
</item>
To refer to the replicant we would do following:
var parent = IWDatacapture.getItem("/topic");
What if the DCR does not have any value inserted for the replicant yet, would the parent be null? If the parent is null, how can we call addInstance()?
Thanks
Susan
Find more posts tagged with
Comments
Johnny
What happens when you try it?
John Cuiuli
syim
I was trying to insert an instance on Save event. When click save, it would give me an Save Error "Save was unsuccessful. Invalid category/type null was received."
Johnny
Posting your DCT/FormAPI (as an attachment) would be your best bet.
John Cuiuli
Migrateduser
In your FormAPI, if you were to alert the value of IWDatacapture.getItem("/topic").getChildren().length, what do you get? I'm wondering because I can see one of two things: you get a JS error saying that it's not an object (worse of the two scenarios) OR it returns -1 or something like that.
If the latter case, you could embed your code in an IF statement that points to the length of getChildren().
Dave
Current Environment(s):
(1) TS 6.1 SP2 on W2K3
(2) TS 6.1 SP2 on W2K
syim
I just came up with an alternative solustion. Instead of setting the min="0" and default="0" to the replicant, I have to set the min="1" and default="1", so the DCR always will have at least an empty element. This way I would be able to refer to the element.