Where is the head function in your code ? Here is an example:
def head = <head><script type="text/javascript" src="/classpath/ jlift.js" /> {Script(json.jsCmd)}</head> Br's, Marius On Sep 15, 5:55 pm, "marius d." <marius.dan...@gmail.com> wrote: > Do you see any errors in FireBug ? ... Do see the Ajax request being > send out in FireBug? > > On Sep 15, 5:49 pm, glenn <gl...@exmbly.com> wrote: > > > Derek, > > > Here is the template. Just as in the book. > > > <lift:surround with="default" at="content"> > > <lift:JSONForm.head /> > > <lift:JSONForm.show> > > <input type="text" name="name" /> > > <br /> > > <input type="text" name="value" /> > > <br /> > > <input type="radio" name="vehicle" value="Bike" /> > > <input type="radio" name="vehicle" value="Car" /> > > <input type="radio" name="vehicle" value="Airplane" /> > > <br /> > > <select name="cars" > > > <option value="volvo">Volvo</option> > > <option value="saab">Saab</option> > > <option value="opel">Opel</option> > > <option value="audi">Audi</option> > > </select> > > <button type="submit">Submit</button> > > </lift:JSONForm.show> > > <div id="json_result"></div> > > </lift:surround> > > > And here is my JSONForm class: > > > class JSONForm { > > > def head = <head>{Script(json.jsCmd)}</head> > > def show(html: Group): NodeSeq = { > > json.jsCmd > > SHtml.jsonForm(json, html) > > } > > > object json extends JsonHandler { > > def apply(in: Any): JsCmd = > > SetHtml("json_result", Text("This is a test")) > > > } > > > } > > > Here, I just simplified the JsCmd returned from the handler. > > > I understand that in the head method, the call to json.jsCmd creates > > the ajax handler (from the apply method), but clicking on the submit > > button on the form doesn't populate the json_result div. In fact, > > it doesn't do anything even though, on the page source, the button's > > onclick method is > > wired up. > > > Glenn > > > On Sep 15, 11:59 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote: > > > > The apply method should be getting called because the SHtml.json method > > > should register it as the handler for the form. Would you mind sending me > > > the code you have and I'll take a look at it? I'm pretty sure this code > > > was > > > working at one point, but perhaps something has changed. > > > > Derek > > > > On Mon, Sep 14, 2009 at 2:03 PM, glenn <gl...@exmbly.com> wrote: > > > > > Actually, the JsonHandler in the example gets called, but not the apply > > > > (in:Any) method, as > > > > that is never called in the book example. Also, the handler seems to > > > > be called twice with every submit. > > > > Why is that? > > > > > Glenn > > > > > On Sep 14, 8:08 am, glenn <gl...@exmbly.com> wrote: > > > > > This may be a question for the Lift Book forum, but has anyone gotten > > > > > the JSON forms example 8.13 in the Lift Book to work? When I tried > > > > > it, the JsonHandler in class JSONForm never gets called when the > > > > > submit button is clicked. > > > > > > Glenn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---