Within my DCT I have a nested replicant named 'copy'. see code below
<container name="rightcol" location="rightcol">
<label>Right Column Content/Highlights Box</label>
<item name="titleimg" pathid="titleimg">
<label>Box Title Image:</label>
<browser required="t" size="40" initial-dir="/images" />
</item>
<item name="copytitle" pathid="copytitle">
<label>Copy Title:</label>
<text required="t" size="40"/>
</item>
<container name="copy" location="copy" min="1" max="20">
<item name="pagecopy" pathid="pagecopy">
<label>Page Copy:</label>
<textarea cols="70" rows="8" required="t"
wrap="virtual" external-editor="visualformat" external-editor-config="/iw/config/custom/theonlinewhatever.xml"/>
</item>
</container>
</container>
Based on a user choice i wish to make the titleimg, copytitel and pagecopy not required.
To do this on titleimg and copytitle I do the following:
IWDatacapture.getItem("/index/rightcol/titleimg").setRequired(false);
IWDatacapture.getItem("/index/rightcol/copytitle").setRequired(false);
This works fine, but when I try to use similar code for the nested replicant, I cant set requited to false. Here is the code:
function setReplicantRequired( dataCaptureItemPath, required ) {
var replicant = IWDatacapture.getItem( dataCaptureItemPath );
var replicantArray = replicant.getChildren();
for ( var i=0; i<replicantArray.length; i++ ) {
var replicantId = i+1;
var containerRef = dataCaptureItemPath + "[" + replicantId + "]
@pagecopy";
IWDatacapture.getItem(containerRef).setRequired(required);
}
}
setReplicantVisibility('/index/rightcol/copy', false);
Any ideas why this wont work?