[Dojo-interest] post bug with multiple params?

Paulo Siqueira paulo.siqueira at gmail.com
Tue Aug 28 03:21:31 UTC 2007


I had to fight ')' and '}' a little bit, but it seems to work.
Thank you! It saved me from having to fall back to 0.4.3 or to have to write
a lot of workaround. =))

On 8/27/07, James Burke <jburke at dojotoolkit.org> wrote:
>
> On 8/27/07, Paulo Siqueira <paulo.siqueira at gmail.com> wrote:
> > > However, using a form that has multiple fields with the same name will
> > > not send all of the values for that name. That issue is being tracked
> > > in this bug:
> > > http://trac.dojotoolkit.org/ticket/4259
> >
> > This is what broke my application. I'll keep an eye on this issue, thank
> > you.
> >  Any chance this will be fixed soon? Or I'm better working around this?
>
> It is scheduled to be fixed for 1.0, but I am not sure when I will get
> to it. Here is a replacement function that *may* work, but it is
> totally untested:
>
> dojo.formToObject = function(/*DOMNode||String*/ formNode){
>         var ret = {};
>         var iq =
> "input[type!=file][type!=submit][type!=image][type!=reset][type!=button],
> select, textarea";
>         dojo.query(iq, formNode).filter(function(node){
>                 return (!node.disabled);
>         }).forEach(function(item){
>                 var _in = item.name;
>                 var type = (item.type||"").toLowerCase();
>                 if((type == "radio")||(type == "checkbox")){
>                         if(item.checked){ ret[_in] = item.value; }
>                 }else if(item.multiple){
>                         var ria = ret[_in] = [];
>                         dojo.query("option[selected]",
> item).forEach(function(opt){
>                                 ria.push(opt.value);
>                         });
>                 }else{
>                         //START of patch
>                         var _iv = ret[_in];
>                         if(_iv){
>                                 if(typeof _iv == "string"){
>                                         ret[_in] = [];
>                                         ret[_in].push(_iv);
>                                 }
>                                 ret[_in].push(item.value);
>                         }else{
>                                 ret[_in] = item.value;
>                         }
>                         //END of patch
>                         if(type == "image"){
>                                 ret[_in+".x"] = ret[_in+".y"] = ret[_in].x
> = ret[_in].y = 0;
>                         }
>                 }
>         });
>         return ret;
> }
>
>
> James
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>



-- 
Paulo R C Siqueira
Sun Certified Java Programmer
http://www.ipti.org.br
Contato: (11) 8149-5046
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070828/4b07c153/attachment-0001.html 


More information about the Dojo-interest mailing list