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)
Using "/../" for addressing the Parent and Sibling
gururaj
How to address siblings?
if(IWDatacapture.getItem(Caption.getName()+"/../Item_Image").value == "");
{
Caption.setValue=" ";
alert("Add the Image first");
}
There was similar code in FormApi html.
TSformapi/formapi/formapi_12.html#SC12
This is in addressing Addressing Parents and Siblings.
They have used "/../" to access the fields.
Please send if there are alternate solutions
Addressing Parents and Siblings
For this custom DTD:
<!ELEMENT b (e, f)>
<!ELEMENT e (#PCDATA)>
<!ELEMENT f (#PCDATA)>
That generates DCRs like this:
<b>
<e>This is e</e>
<f>This is f</f>
</b>
Then the following userscript code returns the item object that corresponds to the element e:
item = IWDatacapture.getItem("/b/e");
To get the parent item that corresponds to the element b, use the `..' notation:
parent = IWDatacapture.getItem(item.getName() + "/..");
To get the sibling item that corresponds to the element f:
siblingItem = IWDatacapture.getItem(item.getName() + "/../f");
Find more posts tagged with
Comments
JonathonG
Are you saying that this (the "/../" addressing) isn't working for you?
Another way to do it is by string manipulation of the address:
item_addr = new String(item.getName());
re = /\/.*$/;
parent_addr = item_addr.replace(re, "");
sibling_addr = parent_addr + "/sibling_name";
HTH,
Jonathon
Independent Interwoven Contractor