<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 src="../../codebase/ext/dhtmlxform_dyn.js"></script>
<script>var myForm,
formData,
sel;
function doOnLoad() {
sel = byId("formName");
formData = [{
type: "settings",
position: "label-left",
labelWidth: 130,
inputWidth: 150,
noteWidth: 160
}, {
type: "input",
name: "name",
label: "Full name",
value: "James Belop",
note: {
text: "please enter your full name here"
}
}, {
type: "input",
name: "mail",
label: "E-mail address",
value: "james@mail.com",
offsetTop: 10
}, {
type: "checkbox",
name: "news",
label: "Subscribe on news",
checked: true,
offsetTop: 10,
note: {
text: "you will get our news once a week"
}
}];
myForm = new dhtmlXForm("myForm", formData);
myForm.forEachItem(function(id) {
sel.options.add(new Option(myForm.getItemText(id), id));
});
}
function byId(id) {
return document.getElementById(id);
}
function setNote() {
myForm.setNote(sel.options[sel.selectedIndex].value, {
text: byId("formNote").value
});
}
function clearNote() {
myForm.clearNote(sel.options[sel.selectedIndex].value);
}
</script>
<div>
<select id="formName"></select>
<input type="text" id="formNote" value="leave blank if you plan to use account as gift for someone">
<input type="button" onclick="setNote();" value="set">
<input type="button" onclick="clearNote();" value="clear">
</div>
<div id="myForm" style="height:500px;margin-top: 50px;"></div>