Opened 13 years ago

Closed 12 years ago

#2255 closed defect (fixed)

dojo.io.bind does not do recursive serialization

Reported by: guest Owned by: alex
Priority: high Milestone: 0.9beta
Component: IO Version: 0.4.1
Keywords: io bind Cc: jeff@…
Blocked By: Blocking:

Description

When calling dojo.io.bind with a nested array, such as:

  content: {
     param0: document.getElementById('something').value,
     param1: {
        qualifier: 'x',
        other: 'y'
     },
     param2: {
        option_a: 1,
        option_b: 2
     }
  }

it behaves by passing the nested "objects" directly without attempting to serialize them first. This makes it impossible to call a function using XmlHttpRequest? which uses hashes for any of its parameters (like one coded in PHP or Python).

Attachments (2)

dojo.2255.patch (1.5 KB) - added by jeff@… 13 years ago.
Patch to fix this issue against 0.4.1-ajax build
dojo.2255.src.patch (543 bytes) - added by jeff@… 13 years ago.
Patch in source tree (src/io/common.js) to resolve issue properly, I think.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by jeff@…

This is definitely *not* a complete and full solution, but ...

Including dojo.json in the build and then making the following change will allow it to be serialized to dojo.io.argsFromMap:

                        if (dojo.lang.isArray(value)){
                                dojo.lang.forEach(value, domap);
                        }else if (typeof(value) == 'object') {
                                domap(dojo.json.serialize(value));
                        }else{
                                domap(value);
                        }

Changed 13 years ago by jeff@…

Attachment: dojo.2255.patch added

Patch to fix this issue against 0.4.1-ajax build

Changed 13 years ago by jeff@…

Attachment: dojo.2255.src.patch added

Patch in source tree (src/io/common.js) to resolve issue properly, I think.

comment:2 Changed 12 years ago by alex

Milestone: 0.9M1
Status: newassigned

since JSON will be in 0.9 base, I'm accepting this for 0.9 but not 0.4.2

comment:3 Changed 12 years ago by alex

Milestone: 0.9M10.9beta

comment:4 Changed 12 years ago by alex

Resolution: fixed
Status: assignedclosed

dojo.toJson and dojo.fromJson are available in Base now as is dojo.formToJson. Use these methods to recursively serialize a form for use w/ the dojo.xhr* methods.

Marking fixed.

Note: See TracTickets for help on using tickets.