There are 2 ways to initialize a dhtmlxForm object:
Firstly, before init you should include related js and css files:
<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>
If you have a ready form on the page and just need to add validation, saving/loading data abilities - use the following code:
<form id="my_form"> ... </form>
var dhxForm = new dhtmlXForm("my_form");
Your config file may have one of the following formats:
In this section we will stint just in 'JSON' variant consideration.
In the beginning, specify an HTML container for your future form.
<div id=" form_container" style="width:280px;height:250px;"></div>
var formData = [ {type: "radio", name: "paymenttype", value:"cash", label:"Cash", checked: true}, {type: "radio", name: "currencytype", value: "dollar", label: "U. S. Dollars", checked: true}, {type: "radio", name: "currencytype", value: "euro", label :"Euro"}, ];
And after that, create a dhtmlxForm object:
var newDhxForm = new dhtmlXForm("dhxFormObj", formData);
For details - see the example.