[html]I have a container(nested) like thisPresBoxPresentationsPresentation Label Use the button at right to upload the PPT file.PPT File[/html]I need to pre-poulate the first replicant label with some value and make it read only and be able to upload .onReplicantaded is not firing when I open the presentation replicant, but it works fine if replicant was opened and saved saved it populates the label value and the upload works. I want to know how can make this work when some on clicks on the replicant +here is my form api function initializeDCR(){ // Make Certain Fields ReadOnly setFieldPermissions();IWEventRegistry.addItemHandler('/document/presbox/presentations/presentation','OnReplicantAdded',handlePresentaion);}function setFieldPermissions() {var presentations = IWDatacapture.getItem('/document/presbox/presentations').getChildren(); // If there are presentations set them up. if (presentations) { handlePresentaion(presentations); } }function handlePresentaion(newitem) { var label0 = 'Presentation Download'; for(var i=0; i < newitem.length;i++){ IWDatacapture.getItem(newitem.getName()+'/attachment_ppt').setReadOnly(true); IWEventRegistry.addItemHandler(newitem.getName()+'/attachment_ppt', "onCallout", handleUrlPath); if(i==0) { IWDatacapture.getItem(newitem.getName()+'/label').setValue(label0); IWDatacapture.getItem(newitem.getName()+'/label').setReadOnly(true); } } IWDatacapture.redraw(); }}
function initializeDCR(){ // Make Certain Fields ReadOnly setFieldPermissions();IWEventRegistry.addItemHandler('/document/presbox/presentations/presentation','OnReplicantAdded',handlePresentaion);}function setFieldPermissions() {var presentations = IWDatacapture.getItem('/document/presbox/presentations').getChildren(); // If there are presentations set them up. if (presentations) { handlePresentaion(presentations); } }function handlePresentaion(newitem) { var label0 = 'Presentation Download'; for(var i=0; i < newitem.length;i++){ IWDatacapture.getItem(newitem.getName()+'/attachment_ppt').setReadOnly(true); IWEventRegistry.addItemHandler(newitem.getName()+'/attachment_ppt', "onCallout", handleUrlPath); if(i==0) { IWDatacapture.getItem(newitem.getName()+'/label').setValue(label0); IWDatacapture.getItem(newitem.getName()+'/label').setReadOnly(true); } } IWDatacapture.redraw(); }}
Try putting these lines in your js script ... in handlePresentaion IWDatacapture.getItem(newitem["+i+"].getName()+'/label').setValue(label0); IWDatacapture.getItem(newitem["+i+"].getName()+'/label').setReadOnly(true);HTH
try this if this works .. in your jsfor(var i=1; i < newitem.length;i++){newitem = IWDatacapture.getItem("/document/presbox/presentations/presentation["+i+"]"); IWDatacapture.getItem(newitem.getName()+'/attachment_ppt').setReadOnly(true); IWEventRegistry.addItemHandler(newitem.getName()+'/attachment_ppt', "onCallout", handleUrlPath);
don't mind, want to clarify one pt, why do you want to get the Name of the item using getName()
Phani thanks for your time on thisbut it throws error on IWDatacapture.getItem(newitem.getName()+'/attachment_ppt').setReadOnly(true); as null
give it a try with this and see if you are getting still a null value ...IWDatacapture.getItem("document/presbox/presentations/presentation["+i+"]/attachment_ppt").setReadOnly(true);
can you repost your formapi code. Also apart from using loop try to get the container value using IWDatacapture.getitem and regex and pass it into variable "i" in tht case you would be sure tht value of "i" is not null.---Phanie
Try the below function code ....function handlePresentaion(newitem) {var label0 = 'Presentation Download';for(var i=1; i < newitem.length; i++){IWDatacapture.getItem("/document/presbox/presentations/presentation["+i+"]/attachment_ppt").setReadOnly(true);IWEventRegistry.addItemHandler('/document/presbox/presentations/presentation["+i+"]', "onCallout", handleUrlPath);if(i==1){IWDatacapture.getItem(/document/presbox/presentations/presentation["+i+"]/label').setValue(label0);IWDatacapture.getItem(/document/presbox/presentations/presentation["+i+"]/label').setReadOnly(true);}}
See if it gives calloutfor(var i=0; i < newitem.length; i++){IWDatacapture.getItem("/document/presbox/presentations/presentation["+i+"]/attachment_ppt").setReadOnly(true);IWEventRegistry.addItemHandler('/document/presbox/presentations/presentation["+i+"]', "onCallout", handleUrlPath);if(i==0){IWDatacapture.getItem(/document/presbox/presentations/presentation["+i+"]/label').setValue(label0);IWDatacapture.getItem(/document/presbox/presentations/presentation["+i+"]/label').setReadOnly(true);}