I pushed code to SHtml.scala to fix ajaxCall and ajaxInvoke.
It's here: http://github.com/dpp/liftweb/tree/tjweir-shtml-js-fix



On Apr 1, 10:59 am, TylerWeir <tyler.w...@gmail.com> wrote:
> Rewriting ajaxCall_* to incorporate Vik's idea fixes this:
>
>   private def ajaxCall_*(jsCalcValue: JsExp, func: AFuncHolder):
> (String, JsExp) = {
>     val (n, r) = fmapFunc(func)(name =>
>         (name, makeAjaxCall(JsRaw("'"+name+"=' +
> "+jsCalcValue.toJsCmd))))
>     ("'" + n + "'", r)
>   }
>
> Thanks.
>
> On Apr 1, 9:37 am, TylerWeir <tyler.w...@gmail.com> wrote:
>
>
>
> > Excellent, thanks Derek, Vik, I'm back on this today.
>
> > On Apr 1, 9:03 am, Viktor Klang <viktor.kl...@gmail.com> wrote:
>
> > > On Wed, Apr 1, 2009 at 2:55 PM, Derek Chen-Becker 
> > > <dchenbec...@gmail.com>wrote:
>
> > > > It looks like it's missing a function call. Compare
>
> > > > onclick="lift_ajaxHandler(...
>
> > > > to
>
> > > > onclick="(F687305521435R3K,lift_ajaxHandler
>
> > > > I'm no JS guru, so that second one might be perfectly valid JS, but it
> > > > looks weird to me.
>
> > > I'd recommend to stay away from referring to objects by reference instead 
> > > of
> > > by id..
> > > (all kinds of weird stuff can happen when you start to remove objects/have
> > > partial rendering)
>
> > > I.e. somefun('F687305521435R3K',lift_ajaxHandler) instead of
> > > somefun(F687305521435R3K,lift_ajaxHandler)
> > > (Note the single-quotes.)
>
> > > > Derek
>
> > > > On Tue, Mar 31, 2009 at 9:57 AM, TylerWeir <tyler.w...@gmail.com> wrote:
>
> > > >> I'm wading into an area that I'm a bit unfamiliar with and not sure if
> > > >> I'm running in a bug.
>
> > > >> Snippet code:
> > > >> class HelloWorld {
> > > >>  def ajaxFunc1() : JsCmd = JsRaw("alert('Button1 clicked')")
>
> > > >>  def ajaxFunc2(str: String) : JsCmd = {
> > > >>    Log.info("Received" + str)
> > > >>    JsRaw("alert('Button2 clicked')")
> > > >>  }
>
> > > >>  def renderAjaxButtons(xhtml: NodeSeq): NodeSeq = {
> > > >>    bind("ex", xhtml,
> > > >>      "button1" -> SHtml.ajaxButton("Press Me", ajaxFunc1 _),
> > > >>      "button2" -> <button>Press Me 2</button> % ("onclick" ->
> > > >> SHtml.ajaxCall(Str("Button-2"), ajaxFunc2 _)))
> > > >>  }
> > > >> }
>
> > > >> Which is in this template:
> > > >>    <lift:HelloWorld.renderAjaxButtons>
> > > >>    <ex:button1 /><br />
> > > >>    <ex:button2 /><br />
> > > >>    </lift:HelloWorld.renderAjaxButtons>
>
> > > >> And is rendered thusly:
> > > >>  <button onclick="lift_ajaxHandler('F687305521434PIG=true', null,
> > > >> null); return false;">Press Me</button><br />
>
> > > >>    <button onclick="(F687305521435R3K,lift_ajaxHandler
> > > >> ('F687305521435R3K=' + 'Button-2', null, null))">Press Me 2</
> > > >> button><br />
>
> > > >> Button 1 is find, but Button 2 causes FireBug to whine:
> > > >> F687305521435R3K is not defined
> > > >> onclick(click clientX=500, clientY=239)2 (line 2)
> > > >> [Break on this error] F687305521435R3K,
> > > >> lift_ajaxHandl...F687305521435R3K=Button-2", null, null);
>
> > > >> Does the second onclick look incorrect to you?
>
> > > --
> > > Viktor Klang
> > > Senior Systems Analyst
--~--~---------~--~----~------------~-------~--~----~
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