Tue, 10 Feb 2009

3:03 PM - Dojo Bug

I've been fighting with Dojo for the last 24 hours over a very stupid bug.  The TextArea widget doesn't appear to work properly with data from an ItemFileReadStore. So setValue didn't give an error, but it didn't put anything in the box either.  Very odd. Here is an excert from the code.  This version works because of the ' ' + .  When that is removed from setValue, the call appears to do nothing.

    function projselect(id)
    {
        var myurl = "admin_invoices_json.php?id=" + dijit.byId('project').valueNode.value;
        //var value = document.forms.frmNewInvoice.project.options[id].value;
        var store = new dojo.data.ItemFileReadStore({url: myurl });
        var newValue = store.fetch(
        {
            query: {project_id: "*"} ,
            onComplete: function(items, request) {                      
                dijit.byId('billingaddress').setValue(' ' + items[0].billing_address);
                dijit.byId('billingperson').setValue(items[0].billing_person);          
            }
        });
    }

<tr>
<td class="formlabel" width="200">Billing Person</td>
<td><input name="billingperson" type="text" id="billingperson" size="45" maxlength="45" value="" dojoType="dijit.form.ValidationTextBox" trim="true" required="true" /></td>
</tr>
<tr>
<td class="formlabel" valign="top">Billing Address</td>
<td><textarea id="billingaddress" name="billingaddress" cols="50" rows="10" dojoType="dijit.form.Textarea"></textarea></td>
</tr>

The JSON

{ identifier: 'project_id', label: 'project_id', items:[{"project_id":"74","billing_person":"Billing Guy","billing_address":"1111 Test St Test County, MI 48108"}]}

tags: json bug html dojo

()