myForm = new dhx.Form(myLayout.getCell("a"), {
, row: [
{type:"radioGroup", name:"radio1", label:"RADIO1", labelPosition:"left"
, options: {
cols: [
{type: "radioButton", text: "AAA", value: "A"}
, {type: "radioButton", text: "BBB", value: "A"}
]
}
}
, {type:"input", name:"test1", label:"TEST1", labelPosition:"left"}
, {type:"datepicker", name:"test2", label:"TEST2", labelPosition:"left"}
, {type:"input", name:"test3", label:"TEST3", labelPosition:"left"}
, {type:"datepicker", name:"test4", label:"TEST4", labelPosition:"left"}
]
});
myForm.events.on("change", function(name, value) {
if(name == "radio1") {
if(value == "A") {
myForm.getItem("test1").show();
myForm.getItem("test2").show();
myForm.getItem("test3").hide();
myForm.getItem("test4").hide();
} else {
myForm.getItem("test1").hide();
myForm.getItem("test2").hide();
myForm.getItem("test3").show();
myForm.getItem("test4").show();
}
}
});
myForm.getItem("radio1").setValue("A");
function btnClick() {
myForm.clear();
myForm.getItem("radio1").setValue("A");
}
radio1 Depending on the radio selection value, test1,test2,test3,test4 is shown or hidden.
If radio1 is selected as “B” and the btnClick() function is executed while test1 and test2 are hidden and then the radio1 value is changed to “B” again, the following error occurs when processing myForm change event and test1, test2 is hidden. but test3 and test4 are not shown.
domvm.micro.js:1224 Uncaught TypeError: Cannot set properties of null (setting '_node')
at patch (domvm.micro.js:1224:1)
at ViewModel.redrawSync [as _redraw] (domvm.micro.js:1647:6)
at hydrateBody (domvm.micro.js:994:1)
at hydrate (domvm.micro.js:1017:6)
at domvm.micro.js:1073:1
at syncChildren (domvm.micro.js:1135:1)
at patchChildren (domvm.micro.js:1427:1)
at patch (domvm.micro.js:1246:5)
at patchChildren (domvm.micro.js:1376:1)
at patch (domvm.micro.js:1246:5)
Why does this error occur?