Dojo TextArea - 数字不是函数

时间:2013-07-29 15:06:41

标签: javascript forms textarea dojo

我收到一个奇怪的错误。当我尝试实例化TextArea时,我得到Uncaught TypeError:number不是函数。但是,如果我将其更改为TextBox,则代码运行正常。我不认为我将构造函数传递给任何无效的东西,并且我在代码中看不到TextArea被覆盖的任何位置。我在我的代码中使用它,直到我在else if块中实例化它。有任何想法吗?

array.forEach(listOfFields, function(item) {
    if(item === "Recent Rain") {
        tr = domConstruct.create("tr", {}, "displayDataForm"),
        td = domConstruct.create("td", {}, tr),
        td1 = domConstruct.create("td", {}, tr),
         l = domConstruct.create("label", {
             innerHTML: 'Rain in Last 24 Hours?: ',
             'class': 'dataFieldLabel',
             'for': item
         }, td, 'first'),
         r = new DropDownSelect({
             'class': 'dataField',
             name: item,
             title: item,
             options: [
                        { label: "Yes", value: "Yes" },
                        { label: "No", value: "No", selected: true },
                      ],
             'data-fieldType': 'DropDownSelect'
         }).placeAt(td1, 'last');
    }
    else if(item === 'Water Color or Odor' || item === 'Aquatic Life Present' || item === 'Site Change') {
        tr = domConstruct.create("tr", {}, "displayDataForm"),
        td = domConstruct.create("td", {}, tr),
        td1 = domConstruct.create("td", {}, tr),
         l = domConstruct.create("label", {
             innerHTML: item + ': ',
             'class': 'dataFieldLabel',
             'for': item
         }, td, 'first'),
         r = new TextArea({
             'class': 'dataField',
             name: item,
             title: item,
             'data-fieldType': 'TextArea'
         }).placeAt(td1, 'last');
    }
    else {
     tr = domConstruct.create("tr", {}, "displayDataForm"),
        td = domConstruct.create("td", {}, tr),
        td1 = domConstruct.create("td", {}, tr),
         l = domConstruct.create("label", {
             innerHTML: item + ': ',
             'class': 'dataFieldLabel',
             'for': item
         }, td, 'first'),
         r = new TextBox({
             'class': 'dataField',
             name: item,
             title: item,
             'data-fieldType': 'TextBox'
         }).placeAt(td1, 'last');
    }
});

更新

以下是我的完整依赖项列表:

        require(["dojo/dom", "dojo/ready", "dojo/request", "dojo/dom-construct", "dojo/dom-attr", "dojo/_base/declare", "dojo/_base/array", "dijit/Dialog", "dijit/form/DateTextBox", "dijit/form/Form", "dijit/form/Button", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/form/TextArea", "dojox/form/DropDownSelect", "dojo/json", "dijit/registry", "dojo/query"],

                function(dom, ready, request, domConstruct, domAttr, declare, array, Dialog, DateTextBox, Form, Button, Checkbox, TextBox, TextArea, DropDownSelect, JSON, registry, query)

我正在使用dijit / form / TextArea

0 个答案:

没有答案