Hi, I want to set the value of a hiddenitem inside a container with a randomly generated value. I have written the following javascript:This doesnt set the value in the hiddenfield for the first replicant that comes by default, but does set the randomvalue for the replicants that are added after that.Also I am not able to save the dcr..It throws some script error and doesnt save. Says "Save was unsuccessful. Invalid category/type null was received."The script error thrown is"Cannot execute code from the freed script"..Can anyone help me out this ?This is the script i wrote:function init() { alert("init called"); IWEventRegistry.addItemHandler("/rootContainer/Container","OnReplicantAdded", initialHandler); initialHandler(IWDatacapture.getItem("/rootContainer/Container[1]"));}function initialHandler(typeItem){ var randomnumber=Math.round(Math.random() * 101) + 1; alert(randomnumber); typeItem.getChildByName("hiddenItem").setValue(randomnumber); alert("done");}IWEventRegistry.addFormHandler("onFormInit", init);
Hi, Thankyou so much. The issue I had in setting the value for the first replicant's item is solved. But I still am not able to save the dcr. It throws the following script error when I click on save.Error isObject doesnt support this property or method.