Hello,
> 1. HTTP parameters MAY arrive in an unpredictable order into the
> servlet. Container may alter their order due to use of maps etc, or
> browsers may even alter it. The point is that parameters order for
> "application/x-www-form-urlencoded" is not specified.
didn't know that - something new every day :).
> 2. Even if the ajax request was sent with the right order (the one
> that we expected) Lift DOES the parameter sorting. This is imperative
> to ensure proper execution order for form functions. Thus since the
> function names that were added after you press the "Add" button are
> lexicographically > then your "submit function name" (there is an
> algorithm generating form function names), your submit function was
> processed BEFORE those fields function.
>
> To cope with this I modified your ajaxButton to:
>
> def ajaxButton(text: NodeSeq, formId: String, func: () => JsCmd,
> attrs: (String, String)*): Elem = {
> val name = "Z" + Helpers.nextFuncName
> addFunctionMap(name, contextFuncBuilder(func))
>
> attrs.foldLeft(
> <button onclick={makeAjaxCall(JsRaw(
> LiftRules.jsArtifacts.serialize(formId).toJsCmd + " + "
> + Str("&" + name + "=true").toJsCmd)).toJsCmd +
> "; return false;"}>{text}</button>)(_ % _)
> }
I see - I'll have to take a look at the algorithm, may be quite interesting.
Although it's logical (and now clear to me) that the functions have to be
executed in the order they were defined; lift had no way to know that the
button function should be called after the update functions, as the function's
name was generated the same way as the button functions.
--
Thanks a lot!
Adam--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.