Handle combination=or in formapi

System
System Administrator
hi,

I have a container in my DCT whose combination attribute is set as or. I need to call a formapi function each time, a user clicks the "+" sign on this container in the DCR and changes the container item.

I tried onReplicantAdded and onItemChange...both of them havent worked for me. Any pointers would be helpful....

TS 7.1/Windows Server

Code snippet:
DCT
-------------
<container name="foo" location="foo" combination="or" min="1" max="1">
....
<container name="a" location=a" min="1" max="10">
.....
</container>
<container name="b" location=b" min="1" max="10">
.....
</container>
<container name="c" location=c" min="1" max="10">
.....
</container>
</container>

JS file:
---------------
IWEventRegistry.addItemHandler("/some path/../foo","onItemChange",myCallbackFunction);
or
IWEventRegistry.addItemHandler("/some path/../foo","onReplicantAdded",myCallbackFunction);

Comments

  • hi,

    I have a container in my DCT whose combination attribute is set as or. I need to call a formapi function each time, a user clicks the "+" sign on this container in the DCR and changes the container item.

    I tried onReplicantAdded and onItemChange...both of them havent worked for me. Any pointers would be helpful....

    TS 7.1/Windows Server

    Code snippet:
    DCT
    -------------
    <container name="foo" location="foo" combination="or" min="1" max="1">
    ....
    <container name="a" location=a" min="1" max="10">
    .....
    </container>
    <container name="b" location=b" min="1" max="10">
    .....
    </container>
    <container name="c" location=c" min="1" max="10">
    .....
    </container>
    </container>

    JS file:
    ---------------
    IWEventRegistry.addItemHandler("/some path/../media_gallery","onItemChange",myCallbackFunction);
    or
    IWEventRegistry.addItemHandler("/some path/../media_gallery","onReplicantAdded",myCallbackFunction);
    What does "media_gallery" XPath maps to, foo, one of abc's or something else?
    Also, with "foo" min/max attributes set to 1 you will not have operational "OR - plus" anyway...
  • Hi ISCBorisB,

    Sorry for the confusion. I have updated the code snippet. it maps to foo.

    I am getting a plus sign on the foo container with an combination="or" set for the sub containers within. when i click on the plus, i see a small menu with options to select the sub containers...say a,b,c.
    If i select b, a is no longer visible and same is the case with c...and so on.

    I want to trap this click of a plus sign using formapi.
  • Hi ISCBorisB,

    Sorry for the confusion. I have updated the code snippet. it maps to foo.

    I am getting a plus sign on the foo container with an combination="or" set for the sub containers within. when i click on the plus, i see a small menu with options to select the sub containers...say a,b,c.
    If i select b, a is no longer visible and same is the case with c...and so on.

    I want to trap this click of a plus sign using formapi.
    Forget FormAPI for a moment. Fix "foo" first. You've allowed only one replicant within it, be it A,B or C.
    When you first pick A and then pick B, it is not that A is no longer visible. A gets replaced by B since there
    is only one slot available for all of them.

    You'd have to modify "foo", to something like that:
    <container name="foo" location="foo" combination="or" min="1" max="unbounded">
  • Hi ISCBorisB,

    That is correct..sounds odd but that is a kind of requirement that exists.

    All i need to know is..is it possible to trap this awkward condition using formapi?

    It is an uncommon and perhaps not so logical requrement but is it possible by any chance? Till now, i havent been able to locate a formapi handler for this...
  • You are missing the point.


    You have a min of 1 and a max of 1. How can you add ? Or remove ?

    If you want the functionality you describe, use a min of 1 max of 2, when a replicant is added, you need to remove the first one in FormAPI, or a min of 0, max 1 and make the user remove the 1st one and then add a new one.
  • Hi Nipper. That sounds like a good approach! Should of thought of this one earlier Smiley Sad...Thank you very much!
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs