I have been trying to solve this problem for the last 10 hours and it is driving me nuts. I have been using this as my guidelines:
http://teamsite.iblogger.org/formapi/I have the following cfg, containing a dropdown list and a browser:
Information box
Choose the content of the information box
Click the 'Browse' button and select an image file
<script language="javascript" location="template-type" src="../scripts/InformationBox.js"/>
-----------javascript InformationBox.js------------:
var image= IWDatacapture.getItem("InformationBox/content/image");
function init() {
alert("--init--");
IWEventRegistry.addItemHandler("InformationBox/content/Choose_box_type", "onItemChange", showInputForSelected);
alert("--done--");
}
function showInputForSelected(){
if(image.isReadOnly()){
alert(image.isReadOnly());
image.setReadOnly(false);
}else{
alert(image.isReadOnly());
image.setReadOnly(true);
}
}
IWEventRegistry.addFormHandler("onFormInit", init);
------------------------------------------------
After having placed alerts i know that the init method is called but the showInputForSelected function is not called when i use the drop down list.
If i add parentheses to showInputForSelected:
IWEventRegistry.addItemHandler("InformationBox/content/Choose_box_type", "onItemChange", showInputForSelected());
showInputForSelected is called once on pageload (?!), setting the inputbrowser to readonly, but never again.
I have tried many more combinations of parentehese, paramters, new functions etc nothing will let me place an eventlistener on the dropdown list.
I really hope someone can help me out here i feel like i have tried everything possible.
Thanks