DHTMLX Docs & Samples Explorer

### Init From XML

Source

    <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>

        <table cellspacing="0" cellpadding="0" border="0">
        <tr><td align="left" valign="top">
            <div id="listObj" style="position: relative; width: 250px;"></div>
        </td><td align="left" valign="top">
            <textarea id="taData" rows="30" cols="100" style="border: #cecece 1px solid;"></textarea>
        </td></tr>
        <tr><td colspan="2">
            <input type="button" value="Update" onclick="update();">
        </td></tr>
        </table>
        <script>var dhxList;
    var t = '<?xml version="1.0"?>\n' + '<items>\n' + '  <item type="radio" name="select" focus="1" class="classname" style="" value="online" label="Will enjoy the online demo"/>\n' + '  <item type="radio" name="select" value="disk" label="Please send me disk" checked="true">\n' + '    <item type="checkbox" name="bootleg" label="Insert bootleg" checked="true"/>\n' + '    <item type="checkbox" name="lyrics" label="Lyrics if possible" checked="true"/>\n' + '    <item type="label" label="Payment"/>\n' + '    <item type="radio" name="paymenttype" value="creditcard" label="Credit Card">\n' + '       <item type="input" name="cardnumber" value="XXXX-XXXX-XXXX-XXXX" label="Card Number"/>\n' + '       <item type="input" name="cardkey" value="XXXX" label="Key"/>\n' + '       <item type="button" name="btn" command="reset" value="Sumbit"/>\n' + '    </item>\n' + '    <item type="radio" name="paymenttype" value="cash" label="Cash" checked="1"/>\n' + '    <item type="label" label="Currency"/>\n' + '    <item type="radio" name="currencytype" value="dollar" label="U. S. Dollars" checked="1"/>\n' + '    <item type="radio" name="currencytype" value="uero" label="Euro"/>\n' + '    <item type="radio" name="currencytype" value="brb" label="Belarusian Rubel"/>\n' + '    <item type="select" name="mediatype" label="Select Media Type">\n' + '      <option value="1" text="CD 700Mb">\n' + '        <item type="checkbox" name="overburn" value="yes_1" checked="true" label="Overburn"/>\n' + '      </option>\n' + '      <option value="2" text="DVD5 4.4Gb">\n' + '        <item type="checkbox" name="lightscribe" value="yes" checked="true" label="Light Scribe"/>\n' + '        <item type="checkbox" name="labelflash" value="yes" label="Label Flash">\n' + '       <item type="radio" name="labelflash_radio" value="required" checked="true" label="Required"/>\n' + '          <item type="radio" name="labelflash_radio" value="not_mandatory" label="Not bad option"/>\n' + '        </item>\n' + '      </option>\n' + '      <option value="3" text="DVD9 8.6Gb" selected="1">\n' + '        <item type="radio" name="86dvd" value="86dvd_1" checked="true" label="Double Layer"/>\n' + '        <item type="radio" name="86dvd" value="86dvd_2" label="Two-Sided"/>\n' + '      </option>\n' + '      <option value="4" text="Blue-Ray 24Gb"/>\n' + '    </item>\n' + '    <item type="select" name="audioquality" label="Select Audio Quality">\n' + '      <option value="1">2.0 16bit/128kbps</option>\n' + '      <option value="2">2.1 16bit/334kbps</option>\n' + '      <option value="3" selected="1">5.1 32bit/448kbps</option>\n' + '    </item>\n' + '    <item type="select" name="videoquality" label="Select Video Quality">\n' + '      <option value="1" text="DVD MPEG-2" selected="1"/>\n' + '      <option value="2" text="DivX"/>\n' + '      <option value="3" text="XviD"/>\n' + '    </item>\n' + '    <item type="input" label="Comments" value="Some Comments" rows="3"/>\n' + '  </item>\n' + '</items>';
    var taData;
    function doOnLoad(loadFromTextArea) {
        if (loadFromTextArea == "sure") {
            t = tdData.value;
        } else {
            tdData = document.getElementById("taData");
            tdData.value = t;
        }
        dhxList = new dhtmlXForm("listObj");
        dhxList.loadStructString(t);
    }
    function update() {
        if (dhxList)
            dhxList.unload();
        doOnLoad("sure");
    }</script>