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)
Populating field in Container based on replicant added in 2 different containers
acezone
Hi All,
I have a situation where requirement is such that client requires dynamic population of field based on replicant added in 2 different container.
Let's elaborate this situation a bit:
<?xml version="1.0" encoding='UTF-8' standalone="no"?>
<!DOCTYPE data-capture-requirements SYSTEM "datacapture6.0.dtd">
<data-capture-requirements type="content" name="portlet">
<ruleset name="portlet">
<root-container name="A" location="A">
<container name="ConA" location="ConA" min="1" max="5">
<label>Container A</label>
<item name="TextA" pathid="TextA">
<text required="t"/>
</item>
</container>
<container name="ConB" location="ConB" min="1" max="2">
<label>Container B</label>
<item name="TextB" pathid="TextB">
<text required="t"/>
</item>
</container>
<container name="ResultAB" location="ResultAB" min="1"
max="10"
>
<!-- Max value for container "ResultAB" should populate dynamically based on each replicant added in ConA(5 replicants) and ConB(2 replicants) respectively (i.e.5x2=10 replicants) -->
<label>Container A</label>
<item name="ResultAText" pathid="ResultAText">
<text required="t"/>
</item>
<item name="ResultALink" pathid="ResultALink">
<browser required="t"/>
</item>
</container>
</root-container>
</ruleset>
</data-capture-requirements>
Any pointer or reference in achieving this functionality would be a great help.
Regards,
Ace
Find more posts tagged with
Comments
nipper
What's the problem ?
It is not trivial but it is fairly standard.
You will need a lot of FormAPI, onReplicantAdded & onReplicantDelete (check those events, typed from memory)
When a container is added, read the other set and dynamically add items to the third set. You can also be lazy and write a function that dumps replicant 3, reads 1 and 2 and then rebuild 3 from scratch. Then you just call it each time a replicant is added/removed.
Adam Stoller
I'm not sure I understand what's so dynamic about that example.
You could probably use an onReplicantAdded event handler for ResultAB, that would retrieve the number of children instances in ConA and ConB and verify that the to-be-added instances of ResultAB is less-than-or-equal-to the product of those two values - but you wouldn't be dynamically changing the max value of the defined structure in the DCT.