Hello,
I have created a form (3beta) with calendar elements:
ppapFormData = [
...
{type:"fieldset", name:"openField", width:245, label:"PPAP timing and comments", position:"absolute", inputTop:140, inputLeft:0, list:[
{type:"label", name:"openLabel", label:" ", labelWidth:50, labelHeight:17},
{type:"calendar", name:"openDate", position:"label-left", labelWidth:130, label:"Confirmed submission plan", value:"", inputWidth:60, dateFormat:"%Y-%m-%d", readonly:true, options:{
yearsRange: [2000, 2020],
isMonthEditable: true,
isYearEditable: true,
enableTime: false
}},
]},
...
{type:"fieldset", name:"statusField", inputWidth:150, label:"PPAP status", position:"absolute", inputTop:140, inputLeft:265, list:[
{type: "radio", name: "ppapStatus", position:"label-right", value:"n", label:"Not applicable"},
{type: "radio", name: "ppapStatus", position:"label-right", value:"0", label:"Open", checked:true},
{type: "radio", name: "ppapStatus", position:"label-right", value:"1", label:"Approved"},
{type: "radio", name: "ppapStatus", position:"label-right", value:"3", label:"Interim approved"},
{type: "radio", name: "ppapStatus", position:"label-right", value:"6", label:"Rejected"},
]},
...
which I initialize in function doOnLoad.
In the same function I show and hide parts of the form depending on the radio buttons which works correctly:
ppapForm = new dhtmlXForm("ppapFormContainer", ppapFormData);
ppapForm.hideItem("approvedField");
ppapForm.hideItem("interimField");
ppapForm.hideItem("rejectedField");
ppapForm.attachEvent("onChange", function(name,value){
if (name=="ppapStatus") {
if (value=="n") {
ppapForm.hideItem("uploadForm");
ppapForm.hideItem("openField");
ppapForm.hideItem("approvedField");
ppapForm.hideItem("interimField");
ppapForm.hideItem("rejectedField");
}
if (value=="0") {
ppapForm.showItem("uploadForm");
ppapForm.showItem("openField");
ppapForm.hideItem("approvedField");
ppapForm.hideItem("interimField");
ppapForm.hideItem("rejectedField");
}
if (value=="1") {
ppapForm.showItem("uploadForm");
ppapForm.hideItem("openField");
ppapForm.showItem("approvedField");
ppapForm.hideItem("interimField");
ppapForm.hideItem("rejectedField");
ppapForm.setItemValue("approvedDate", "2011-04-04");
}
}
});
The form is attached to a window which is created later, not in the doOnLoad function.
ppapForm.setItemValue does not set any value. If I check with getItemValue the value is null.
What is the issue?
Is it correct to do the hide and show stuff in the doOnLoad function?