Ok I just looked on your code. The problem is that you put the ajax
button inside the form and there is not reason for that.

I changed your code to something like:

    bind("cont", containerTemplate,
      "name" -> { println("bind container name " + cont.name);
SHtml.text(cont.name,
              (s: String) => {println("set container name " + s);
cont.name = s; }) },
      "rooms" -> editRoom _
      ) ++ ajaxButton(Text("Add"), "cont_edit",
        () => { println("executing funtion"); cont.rooms += new Room;
reDraw })


So the button is outside the form now. Otherwise your dynamic added
field were appended in the form after the add button location. I
removed from your template <cont:add /> (or whatever the name was). I
tested it and the behavior appears correct to me now. Field values are
preserved correctly.

So this being an ajaxButton it shouldn't be inside a form especially
when the form content is changed dynamically. If you have a form with
"static" fields and put the button after all fields, I'm pretty sure
it'll also work.


Br's,
Marius

On Jan 15, 6:38 pm, Adam Warski <a...@warski.org> wrote:
> > I kinda doubt that as I tested with a bunch of form fields. In the
> > ajax request the function ID of the ajax function was always the last
> > in the parameters and functions are evaluated in canonical order (for
> > the same owner). But I think you sent me your source code location and
> > I need to look what's in there this weekend. I Hope your code that
> > works as you described is still there :)
>
> Yep, it's still there:http://github.com/adamw/lift-ajax-submit-test
> Just run it, add one element, fill in the two input fields, and click add 
> again, you should see the input disappearing.
>
> 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 lift...@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