James,

I just committed the fix based on your approach. Please give it a try.

Br's,
Marius

On Jul 30, 4:53 pm, "marius d." <marius.dan...@gmail.com> wrote:
> Thank you James for your input. I hope I'll be able to look into it
> today.
>
> Br's,
> Marius
>
> On Jul 30, 4:42 pm, James Kearney <ghostf...@googlemail.com> wrote:
>
> > I think the current implementation of the JSON form is broken.
>
> > If you put an & in a text field and try to submit it via a JSON form
> > it doesn't get handled correctly.
>
> > To be precise the formToJSON function in jlift.js doesn't work, and
> > again to be more precise the params method is broken / not fit for
> > purpose.
>
> > The params method (line 249) calls s.join("&") and then returns but it
> > doesn't escape the & character (it also uses = but doesn't escape
> > that). If the params function does what I think it is supposed to do
> > which is split paramters for a URL then it should really call
> > encodeURI on the values.
>
> > That aside I don't think the formToJSON function should be using the
> > param function. It gets a JSON object from jQuery serializeArray makes
> > it into a string split by & and = then goes and splits based on & and
> > = again building up some JSON (as a string) then parses the JSON. Why
> > not operate on the JSON from jQuery from the start.
> > e.g.
>
> > formToJSON : function(formId)
> >            {
> >                json = jQuery("#" + formId).serializeArray();
> >                ret = {}
>
> >                for (var i in json)
> >                {
> >                    var obj = json[i]
>
> >                    ret[obj.name] = obj.value
> >                }
>
> >                return ret;
> >            }
>
> > This does work differently from before since it won't call functions
> > like params does but I don't think jQuery's serializeArray puts
> > functions in the object it returns so that is not needed.
>
> > James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to