I have a DCT where the same field exists in the DCR at many different places.Example: where X is the item to register events/root/X/root/container/X/root/item/container/item/X/root/item/container/XTo register event handlers for all these locations of item "X" today I have the following:IWEventRegistry.addItemHandler(/root/X.........................................IWEventRegistry.addItemHandler(/root/container/X...............................IWEventRegistry.addItemHandler(/root/item/container/item/X.....................IWEventRegistry.addItemHandler(/root/item/container/X..........................Is there a way to do something similar to xpath where I could just sayIWEventRegistry.addItemHandler(//XI need to to perform well for large DCR's that have been previosuly saved so trawling through the content onFormInit() and registering the events as they are found may not meet the performance requirement. Adding handlers using the available API is fine when adding replicants and would be fast enough but the events need to be on existing saved elements when saved data is edited. The long method works but in highly recursive DCR sachems there must be a better way.
Adding handlers using the available API is fine when adding replicants and would be fast enough but the events need to be on existing saved elements when saved data is edited.
IWEventRegistry.addFormHandler("/path/to/replicant[0]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[1]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[2]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[3]/item", ...);
IWEventRegistry.addFormHandler("/path/to/replicant/item", ...);
Sounds to me like you may not be aware that IWEventRegistry.addFormHandler("/path/to/replicant[0]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[1]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[2]/item", ...);IWEventRegistry.addFormHandler("/path/to/replicant[3]/item", ...); can be simplified with IWEventRegistry.addFormHandler("/path/to/replicant/item", ...); this will cause all instances of "replicant" to have a handler on its "item", regardless of how many instances you have saved and how many new ones you add/remove when editing.
See if [thread=20870]this[/thread] and [thread=21999]this[/thread] threads may help a little
IWEventRegistry.addItemHandler("/path/to/replicant/item", ...);
addFormHandler does not accept itemname as a param.