<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,
myForm2;
function doOnLoad() {
formData = [{
type: "settings",
position: "label-left",
labelWidth: 250,
inputWidth: 120
}, {
type: "fieldset",
label: "Number Formats",
inputWidth: "auto",
list: [{
type: "input",
name: "t1",
label: "Format: 0,000.00",
value: "1234567.8987",
numberFormat: "0,000.00"
}, {
type: "input",
name: "t2",
label: "Format: @ 0,00 (before_change=false)",
value: "123456.78",
numberFormat: ["@ 0,00", ":"]
}, {
type: "input",
name: "t3",
label: "Format: $ 0.00",
value: "125750.99",
numberFormat: ["$ 0,000.00", ",", "."]
}, {
type: "input",
name: "t4",
label: "Format: 0,000 Rub",
value: "10250.45",
numberFormat: ["0,000 Rub", "'"]
}, {
type: "input",
name: "t5",
label: "Format: 0,000.00 Kr (set with script)",
value: "99570.45"
}]
}];
myForm = new dhtmlXForm("myForm", formData);
myForm.setNumberFormat("t5", "0,000.00 Kr", "'", ",");
myForm.attachEvent("onChange", function() {
});
myForm.attachEvent("onBeforeChange", function(name) {
return (name != "t2");
});
myForm2 = new dhtmlXForm("myForm2");
myForm2.loadStruct("../common/dhxform_numberformat.xml?etc=" + new Date().getTime(), function() {
myForm2.setNumberFormat("t5", "0,000.00 Kr", "'", ",");
});
}
</script>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="left" valign="top"><div id="myForm"></div></td>
<td align="left" valign="top"><div id="myForm2" style="margin-left: 30px;"></div></td>
</tr>
</table>
<div style="padding-top: 10px;">
<b>JSON</b> { numberFormat: "format" } or { numberFormat: ["format", "group_sep", "dec_sep"] }<br>
<b>XML</b> < numberFormat="format" groupSep="group_sep" decSep="dec_sep" ><br>
<br>
"format" required, "group_sep" and "dec_sep" optional, "," and "." are defaults
</div>