I have the following code for making the replicants in container readonlyit working fine when I add new replicants on form(all are read only)....but when I save and open only the first one is readonly. I need all to be readonly.can anyone suggest the solution? ------------------------------ // Call the initialization routine on load.IWEventRegistry.addFormHandler("onFormInit", initializeForm);function initializeForm() {IWEventRegistry.addItemHandler('/document/a_items/b_item','OnReplicantAdded',newdata);setreadonly(); try { } catch (e) { setTimeout(function(){initializeForm()}, 100); }}function newdata(newitem){ var item=newitem.getName(); IWDatacapture.getItem(item+'/title').setReadOnly(true); IWDatacapture.getItem(item+'/description').setReadOnly(true); IWDatacapture.getItem(item+'/id').setReadOnly(true); IWDatacapture.redraw();}function setreadonly(){ var resContainer = IWDatacapture.getItem('/document/a_items/b_item').getChildren(); // If Res Container found, iterate through and set them up. if (resContainer) { for (var i=0; i<resContainer.length; i++) { var resContainerItems = resContainer.getChildren(); if (resContainerItems) { for (var i=0; i<resContainerItems.length; i++) { resContainerItems.setReadOnly(true); } } } }} TS 6.7.1
// Call the initialization routine on load.IWEventRegistry.addFormHandler("onFormInit", initializeForm);function initializeForm() {IWEventRegistry.addItemHandler('/document/a_items/b_item','OnReplicantAdded',newdata);setreadonly(); try { } catch (e) { setTimeout(function(){initializeForm()}, 100); }}function newdata(newitem){ var item=newitem.getName(); IWDatacapture.getItem(item+'/title').setReadOnly(true); IWDatacapture.getItem(item+'/description').setReadOnly(true); IWDatacapture.getItem(item+'/id').setReadOnly(true); IWDatacapture.redraw();}function setreadonly(){ var resContainer = IWDatacapture.getItem('/document/a_items/b_item').getChildren(); // If Res Container found, iterate through and set them up. if (resContainer) { for (var i=0; i<resContainer.length; i++) { var resContainerItems = resContainer.getChildren(); if (resContainerItems) { for (var i=0; i<resContainerItems.length; i++) { resContainerItems.setReadOnly(true); } } } }}
function setreadonly(){ var resContainer = IWDatacapture.getItem('/document/a_items/b_item').getChildren(); // If Res Container found, iterate through and set them up. if (resContainer) { for (var i=0; i<resContainer.length; i++) { newdata(resContainer); } }}
I'm not positive, but if your first function is working, I think your second function could be simplified to:function setreadonly(){ var resContainer = IWDatacapture.getItem('/document/a_items/b_item').getChildren(); // If Res Container found, iterate through and set them up. if (resContainer) { for (var i=0; i<resContainer.length; i++) { newdata(resContainer); } }}