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)
How to define multiple replicants insert each time
enthusiast
Is it possible to define within a container an option to add a certain number of replicants for each click on "+". e.g. in multiple of "2s"
<container name="whats_playing" location="whats_playing" min="2" max="8">
<label>Promo</label>
<item name="whats_playing_promo" pathid="whats_playing_promo">
<label>What’s Playing Promo</label>
<select size="1" required="f">
<option value="" label="Select" />
</select>
</item>
</container>
Find more posts tagged with
Comments
Adam Stoller
You might be able to implement this with replicant handlers and a field - probably outside the replicant - that provided a drop-down choice of something like [1][2][3][4] (I kind of doubt you need more than 2, a seriously doubt you should need more than 4). The replicant handler could then, I believe, insert N instances when called.
The only caveat I can think of would be a potential looping where the replicant handler says insert N instances, and each of the insertions call the same handler which then themselves insert N instances (I told two friends, and they told two friends, ...)
So a little trial-and-error is going to be necessary.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
mstradling
The quick and dirty solution is to have a container inside the replicant. This container has 2 sets of the fields, a-la
<replicant>
<container>
<item name="bob1">
<text/>
</item>
<item name="bob2">
<text/>
</item>
</container>
</replicant>
You then loop over the replicant and for each loop, loop over bob1 and bob2.
A more elegent solution would be using FormAPI as already suggested.
OliStreek
If you need to keep the pairs of replicants together, you might find it easier to use containers within your replicant instead. If, for example, you need the pairs to be deleted or moved together, then you could end up writing quite a bit of Form API code. It would certainly be doable, but it’s not a five minute job.
I don’t like the idea of creating more levels of nesting than necessary, but using another container might be appropriate in this instance, if you do have this requirement.