I need to build a form with a calendar and some combo controls on it.
When I try to load data from XML to a combo inside the form I am receiving the error “combopayee is null” in FF with FireBug. I’ve searched this forum and documentation but I cannot find a solution.
Here is the main page code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="./../includes/DHTMLX/dhtmlxsuite/dhtmlxfull/dhtmlx.css">
<script src="./../includes/DHTMLX/dhtmlxsuite/dhtmlxfull/dhtmlx.js"></script>
</head>
<body onload="doOnLoad()">
<div id="form_container" style="width:250px;height:300px;"></div>
<script>
window.dhx_globalImgPath="./../includes/DHTMLX/dhtmlxsuite/dhtmlxfull/imgs/";
var myForm;
function doOnLoad() {
myForm = new dhtmlXForm("form_container");
myForm.loadStruct("data/form_debt.xml");
var combopayee = myForm.getCombo("payee");
combopayee.loadXML("data/combo_payee.xml");
}
</script>
</body>
</html>
The form structure
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item type="fieldset" name="data" label="Preencha os Dados" inputWidth="auto">
<item type="calendar" name="data" label="Data" calendarPosition="right" dateFormat="%Y-%m-%d" position="label-top"/>
<item type="combo" name="payee" label="Fornecedor" position="label-top"/>
<item type="button" name="save" value="Proceed"/>
</item>
</items>
And the XML file
<?xml version="1.0" ?>
<complete>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option value="4">four</option>
<option value="5">five</option>
<option value="6">six</option>
<option value="7">seven</option>
<option value="8">eight</option>
<option value="9">nine</option>
<option value="10">ten</option>
</complete>
What am I doing wrong?