I have a custom upload field item which contains an "upload" button at the bottom. When I set the disabled property to false initially, all the fields in by cwuploaditem is disabled. But if I disable it using disable(), all fields except for the Upload button are disabled. I expect everything to be disabled/enabled whether I call the function or set the property.
Code:
isc.screenReader = true;
isc.ClassFactory.defineClass("CwUploadItem", "CanvasItem");
isc.CwUploadItem.addProperties({
init:function () {
var formFields = [
{ name: this.cwtitle,
type: "UploadItem",
colSpan: 2,
width: 250,
showFocused: false,
textBoxStyle: "formCell"}
];
if (this.cwShowButton) {
formFields[1] = { _constructor: "SpacerItem", colSpan: 3 };
formFields[2] = { _constructor: "SpacerItem", colSpan: 1, startRow: true };
formFields[3] = { _constructor: "SpacerItem", colSpan: 1, width: 30};
formFields[4] = {
title: this.buttonLabel,
click: this.customClick,
type: "button",
width: 100,
startRow: false,
buttonConstructor: isc.Button
};
}
this.canvas =
isc.DynamicForm.create({
ID: this.upID+"$cwUpload",
upID: this.upID,
target : "upload_frame",
encoding : "multipart",
numCols: 3,
width: 200,
height: this.height,
colWidths: [1,1,200],
fields : formFields
});
return this.Super("init", arguments);
}
});
isc.DynamicForm.create({ID:"testUpload",fields:[{_constructor: "CwUploadItem", ID:"testUploadField", title: "testUpload", buttonLabel:"upload", cwShowButton:true, disabled:true}]});
isc.Button.create({top:200, title: "enable/disable upload", click: function(){
if(testUploadField.isDisabled()){
testUploadField.enable();
}else{
testUploadField.disable();
}
}});
Comment