Hello,
I'm trying to pick values in a textbox, set them to a mapper field and
persist to the database using Ajax but it don't seem to want to send
the value to the database despite the fact that it picks it up from
the textboxs. I've tried a lot of code and it does not seem to work,
please help me with this. The codes are:

Snippet:

class VendorManipulator {

    def edit(tags : NodeSeq) : NodeSeq = {
        val vendor = Vendor.create

        def processEntries():JsCmd = {
            val saveAndDisplay = {vendor.save; println("Saved!")
                                  ajaxInvoke(() => SetHtml
("data_saved", <span>
                        <h1>Data saved:</h1> <br/> Company name:
{vendor.name.is}
                        <br/>Date Established:
{vendor.dateEstablished}
                        <br/>Location: {vendor.location} </span>
                ))._2}
            ajaxCall(ValById("txt_name"), (s) => {vendor.name
(s);println("name: "+s);JsRaw("")})._2 &
            ajaxCall(ValById("txt_loc"), (s) => {vendor.location
(s);println("location: "+s);JsRaw("")})._2 & saveAndDisplay
        }

        bind("vm", tags,
             "name" -> text(vendor.name.is, vendor.name(_), "id" ->
"txt_name"),
             "location" -> text(vendor.location.is, vendor.location
(_), "id" -> "txt_loc"),
             "submit" -> ajaxButton("Save", processEntries _)
        )
    }
}

Markup:

<lift:VendorManipulator.edit form="post">
            Name <vm:name /><br />
            Location <vm:location /><br />
            <vm:submit />
        </lift:VendorManipulator.edit>

Vendor is a mapper object. The "Saved!", "name: xxxx" and "location:
xxxx" shows on the console but the values are not persisted to the
database.
-- 
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.


Reply via email to