<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxform_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxform.js"></script>
<script>var myForm,
formData;
function doOnLoad() {
formData = [{
type: "settings",
position: "label-right"
}, {
type: "checkbox",
name: "t1",
label: "Checkbox t1 with value «green»",
value: "green"
}, {
type: "checkbox",
name: "t2",
label: "Checkbox t2 without default value"
}, {
type: "checkbox",
name: "t3",
label: "Checkbox t3 with value «green» checked",
value: "green",
checked: true
}, {
type: "checkbox",
name: "t4",
label: "Checkbox t4 without default value checked",
checked: true
}, {
type: "checkbox",
name: "t5",
label: "Checkbox t5 with value «red» checked",
value: "red",
checked: true
}];
myForm = new dhtmlXForm("myForm", formData);
}
function setFormData(value) {
myForm.setFormData({
t1: value,
t2: value,
t3: value,
t4: value,
t5: value
});
}
function getFormData() {
var t = myForm.getFormData();
var p = "";
for (var a in t)
p += a + ": " + String(t[a]) + "\n";
document.getElementById("res").value = p;
}
</script>
<div id="myForm"></div>
<div style="clear: both; padding-top: 50px; padding-bottom: 20px;">
<input type="button" value="setFormData(true)" onclick="setFormData(true);">
<input type="button" value="setFormData('true')" onclick="setFormData('true');">
<input type="button" value="setFormData(1)" onclick="setFormData(1);">
<input type="button" value="setFormData('1')" onclick="setFormData('1');">
<br><br>
<input type="button" value="setFormData(false)" onclick="setFormData(false);">
<input type="button" value="setFormData('false')" onclick="setFormData('false');">
<input type="button" value="setFormData(0)" onclick="setFormData(0);">
<input type="button" value="setFormData('0')" onclick="setFormData('0');">
<br><br>
<input type="button" value="setFormData('')" onclick="setFormData('');">
<input type="button" value="setFormData('green')" onclick="setFormData('green');">
<input type="button" value="setFormData('red')" onclick="setFormData('red');">
</div>
<div style="clear: both; padding-top: 20px; border-top: 1px solid #cecece;">
<input type="button" value="getFormData()" onclick="getFormData();">
<br><br>
<textarea id="res" cols="50" rows="5"></textarea>
</div>