[Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread Marius
This same thing is also touched by http://reviewboard.liftweb.net/r/184/
(driven by Kris' post)

Do you agree with these following statements:

1. The SHtml Ajax function should return JsCmd
2. The SHtml non Ajax function should return a Unit instead of Any
(unless there are compelling reasons to keep Any)

If so I could probably make the adjustments today since I'm on that
defect anyways.

Br's,
Marius

On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 

 felipero.maill...@gmail.com wrote:
  That's a little better.. thanks

 Originally, the function returned Any... and this led to problems (people
 returning HTML, Strings, etc.)  It turns out that 95% of the time, you want
 to do something to tell the user that the server did something (unless the
 function sends a message to a CometActor), so using the type-system to make
 sure Ajax functions returned JsCmds was the right answer.





  greekscala wrote:

  Hello,

  know what you mean. You can use JsCmds._Noop to return nohting as
  JsCmd.

  best regards

  On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
  wrote:

  Here is how I made it, but seems ugly:

  SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

  It is awkward having to add a JsCmd even when I don't need it.

  Felipe

  Naftoli Gugenheim wrote:

  Never mind my question; I hadn't paid attention to the subject.
       -
  Felipe Rodriguesfelipero.maill...@gmail.com wrote:
       Hi all,
       I want to create a link which when clicked calls a server side
  function.
  No need for JavaScript callback.
  I tried with no success:
       SHtml.a(() = {serverSideFunction(t.text)}, t)
       Any idea how can I accomplish that will be appreciated.
       Thanks,
       Felipe

  --
  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.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

-- 
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.



Re: [Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread David Pollak
On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:

 This same thing is also touched by http://reviewboard.liftweb.net/r/184/
 (driven by Kris' post)

 Do you agree with these following statements:

 1. The SHtml Ajax function should return JsCmd


Yes.


 2. The SHtml non Ajax function should return a Unit instead of Any
 (unless there are compelling reasons to keep Any)


There is a compelling reason to keep Any.  I can't remember it right now,
but there is a really, really good reason (I've made the change to Unit in
the past and it broke a pile of stuff in my applications.)



 If so I could probably make the adjustments today since I'm on that
 defect anyways.

 Br's,
 Marius

 On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
 
  felipero.maill...@gmail.com wrote:
   That's a little better.. thanks
 
  Originally, the function returned Any... and this led to problems (people
  returning HTML, Strings, etc.)  It turns out that 95% of the time, you
 want
  to do something to tell the user that the server did something (unless
 the
  function sends a message to a CometActor), so using the type-system to
 make
  sure Ajax functions returned JsCmds was the right answer.
 
 
 
 
 
   greekscala wrote:
 
   Hello,
 
   know what you mean. You can use JsCmds._Noop to return nohting as
   JsCmd.
 
   best regards
 
   On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
   wrote:
 
   Here is how I made it, but seems ugly:
 
   SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd},
 t)
 
   It is awkward having to add a JsCmd even when I don't need it.
 
   Felipe
 
   Naftoli Gugenheim wrote:
 
   Never mind my question; I hadn't paid attention to the subject.
-
   Felipe Rodriguesfelipero.maill...@gmail.com wrote:
Hi all,
I want to create a link which when clicked calls a server side
   function.
   No need for JavaScript callback.
   I tried with no success:
SHtml.a(() = {serverSideFunction(t.text)}, t)
Any idea how can I accomplish that will be appreciated.
Thanks,
Felipe
 
   --
   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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
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.



Re: [Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread Naftoli Gugenheim
I'm curious to know the difference between returning Any or Unit, if you 
remember. Is it possible it was a bug in Scala?

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:

 This same thing is also touched by http://reviewboard.liftweb.net/r/184/
 (driven by Kris' post)

 Do you agree with these following statements:

 1. The SHtml Ajax function should return JsCmd


Yes.


 2. The SHtml non Ajax function should return a Unit instead of Any
 (unless there are compelling reasons to keep Any)


There is a compelling reason to keep Any.  I can't remember it right now,
but there is a really, really good reason (I've made the change to Unit in
the past and it broke a pile of stuff in my applications.)



 If so I could probably make the adjustments today since I'm on that
 defect anyways.

 Br's,
 Marius

 On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
 
  felipero.maill...@gmail.com wrote:
   That's a little better.. thanks
 
  Originally, the function returned Any... and this led to problems (people
  returning HTML, Strings, etc.)  It turns out that 95% of the time, you
 want
  to do something to tell the user that the server did something (unless
 the
  function sends a message to a CometActor), so using the type-system to
 make
  sure Ajax functions returned JsCmds was the right answer.
 
 
 
 
 
   greekscala wrote:
 
   Hello,
 
   know what you mean. You can use JsCmds._Noop to return nohting as
   JsCmd.
 
   best regards
 
   On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
   wrote:
 
   Here is how I made it, but seems ugly:
 
   SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd},
 t)
 
   It is awkward having to add a JsCmd even when I don't need it.
 
   Felipe
 
   Naftoli Gugenheim wrote:
 
   Never mind my question; I hadn't paid attention to the subject.
-
   Felipe Rodriguesfelipero.maill...@gmail.com wrote:
Hi all,
I want to create a link which when clicked calls a server side
   function.
   No need for JavaScript callback.
   I tried with no success:
SHtml.a(() = {serverSideFunction(t.text)}, t)
Any idea how can I accomplish that will be appreciated.
Thanks,
Felipe
 
   --
   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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
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.

-- 
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.



Re: [Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread David Pollak
On Fri, Jan 22, 2010 at 10:36 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I'm curious to know the difference between returning Any or Unit, if you
 remember. Is it possible it was a bug in Scala?


Returning Any returns the value of the last expression in the function.
Returning Unit always returns the Unit instance.  In some places (I think
when processing Ajax forms) we take the return value from the functions and
try to determine if they are meant as JavaScript or somesuch to be sent back
to the browser.



 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:

  This same thing is also touched by http://reviewboard.liftweb.net/r/184/
  (driven by Kris' post)
 
  Do you agree with these following statements:
 
  1. The SHtml Ajax function should return JsCmd
 

 Yes.


  2. The SHtml non Ajax function should return a Unit instead of Any
  (unless there are compelling reasons to keep Any)
 

 There is a compelling reason to keep Any.  I can't remember it right now,
 but there is a really, really good reason (I've made the change to Unit in
 the past and it broke a pile of stuff in my applications.)


 
  If so I could probably make the adjustments today since I'm on that
  defect anyways.
 
  Br's,
  Marius
 
  On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
  
   felipero.maill...@gmail.com wrote:
That's a little better.. thanks
  
   Originally, the function returned Any... and this led to problems
 (people
   returning HTML, Strings, etc.)  It turns out that 95% of the time, you
  want
   to do something to tell the user that the server did something (unless
  the
   function sends a message to a CometActor), so using the type-system to
  make
   sure Ajax functions returned JsCmds was the right answer.
  
  
  
  
  
greekscala wrote:
  
Hello,
  
know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.
  
best regards
  
On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
  
Here is how I made it, but seems ugly:
  
SHtml.a(() = {serverSideFunction(t.text); Call(void,
 Num(0)).cmd},
  t)
  
It is awkward having to add a JsCmd even when I don't need it.
  
Felipe
  
Naftoli Gugenheim wrote:
  
Never mind my question; I hadn't paid attention to the subject.
 -
Felipe Rodriguesfelipero.maill...@gmail.com wrote:
 Hi all,
 I want to create a link which when clicked calls a server
 side
function.
No need for JavaScript callback.
I tried with no success:
 SHtml.a(() = {serverSideFunction(t.text)}, t)
 Any idea how can I accomplish that will be appreciated.
 Thanks,
 Felipe
  
--
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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
  
.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.
  
   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics
 
  --
  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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 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
 

[Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread Marius
Very well then. If you do recall the rationale for keeping Any for non
Ajax function, please let me/us know about it or add a comment in the
code as I get the feeling that this will raise up again in the future.

Br's,
Marius

On Jan 22, 8:36 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I'm curious to know the difference between returning Any or Unit, if you 
 remember. Is it possible it was a bug in Scala?

 -

 David Pollakfeeder.of.the.be...@gmail.com wrote:
 On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:
  This same thing is also touched byhttp://reviewboard.liftweb.net/r/184/
  (driven by Kris' post)

  Do you agree with these following statements:

  1. The SHtml Ajax function should return JsCmd

 Yes.

  2. The SHtml non Ajax function should return a Unit instead of Any
  (unless there are compelling reasons to keep Any)

 There is a compelling reason to keep Any.  I can't remember it right now,
 but there is a really, really good reason (I've made the change to Unit in
 the past and it broke a pile of stuff in my applications.)





  If so I could probably make the adjustments today since I'm on that
  defect anyways.

  Br's,
  Marius

  On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 

   felipero.maill...@gmail.com wrote:
That's a little better.. thanks

   Originally, the function returned Any... and this led to problems (people
   returning HTML, Strings, etc.)  It turns out that 95% of the time, you
  want
   to do something to tell the user that the server did something (unless
  the
   function sends a message to a CometActor), so using the type-system to
  make
   sure Ajax functions returned JsCmds was the right answer.

greekscala wrote:

Hello,

know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.

best regards

On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:

Here is how I made it, but seems ugly:

SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd},
  t)

It is awkward having to add a JsCmd even when I don't need it.

Felipe

Naftoli Gugenheim wrote:

Never mind my question; I hadn't paid attention to the subject.
     -
Felipe Rodriguesfelipero.maill...@gmail.com wrote:
     Hi all,
     I want to create a link which when clicked calls a server side
function.
No need for JavaScript callback.
I tried with no success:
     SHtml.a(() = {serverSideFunction(t.text)}, t)
     Any idea how can I accomplish that will be appreciated.
     Thanks,
     Felipe

--
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.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com

.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

  --
  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.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

 --
 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 
 athttp://groups.google.com/group/liftweb?hl=en.

-- 
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.



Re: [Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread Naftoli Gugenheim
Sorry for not being more precise.
If I understood you, you said there are times where a function whose return 
value is *not* used, but still code broke when the expected type was changed to 
the more correct Unit. Is that not what you were referring to when you said you 
don't remember why but it broke a lot of code?

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

On Fri, Jan 22, 2010 at 10:36 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I'm curious to know the difference between returning Any or Unit, if you
 remember. Is it possible it was a bug in Scala?


Returning Any returns the value of the last expression in the function.
Returning Unit always returns the Unit instance.  In some places (I think
when processing Ajax forms) we take the return value from the functions and
try to determine if they are meant as JavaScript or somesuch to be sent back
to the browser.



 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:

  This same thing is also touched by http://reviewboard.liftweb.net/r/184/
  (driven by Kris' post)
 
  Do you agree with these following statements:
 
  1. The SHtml Ajax function should return JsCmd
 

 Yes.


  2. The SHtml non Ajax function should return a Unit instead of Any
  (unless there are compelling reasons to keep Any)
 

 There is a compelling reason to keep Any.  I can't remember it right now,
 but there is a really, really good reason (I've made the change to Unit in
 the past and it broke a pile of stuff in my applications.)


 
  If so I could probably make the adjustments today since I'm on that
  defect anyways.
 
  Br's,
  Marius
 
  On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
  
   felipero.maill...@gmail.com wrote:
That's a little better.. thanks
  
   Originally, the function returned Any... and this led to problems
 (people
   returning HTML, Strings, etc.)  It turns out that 95% of the time, you
  want
   to do something to tell the user that the server did something (unless
  the
   function sends a message to a CometActor), so using the type-system to
  make
   sure Ajax functions returned JsCmds was the right answer.
  
  
  
  
  
greekscala wrote:
  
Hello,
  
know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.
  
best regards
  
On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
  
Here is how I made it, but seems ugly:
  
SHtml.a(() = {serverSideFunction(t.text); Call(void,
 Num(0)).cmd},
  t)
  
It is awkward having to add a JsCmd even when I don't need it.
  
Felipe
  
Naftoli Gugenheim wrote:
  
Never mind my question; I hadn't paid attention to the subject.
 -
Felipe Rodriguesfelipero.maill...@gmail.com wrote:
 Hi all,
 I want to create a link which when clicked calls a server
 side
function.
No need for JavaScript callback.
I tried with no success:
 SHtml.a(() = {serverSideFunction(t.text)}, t)
 Any idea how can I accomplish that will be appreciated.
 Thanks,
 Felipe
  
--
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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
  
.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.
  
   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics
 
  --
  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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

 --
 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 

Re: [Lift] Re: Simple Ajax call to server side function

2010-01-22 Thread David Pollak
On Fri, Jan 22, 2010 at 12:57 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Sorry for not being more precise.
 If I understood you, you said there are times where a function whose return
 value is *not* used,


You misunderstood me.


 but still code broke when the expected type was changed to the more correct
 Unit. Is that not what you were referring to when you said you don't
 remember why but it broke a lot of code?

 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Fri, Jan 22, 2010 at 10:36 AM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  I'm curious to know the difference between returning Any or Unit, if you
  remember. Is it possible it was a bug in Scala?
 

 Returning Any returns the value of the last expression in the function.
 Returning Unit always returns the Unit instance.  In some places (I think
 when processing Ajax forms) we take the return value from the functions and
 try to determine if they are meant as JavaScript or somesuch to be sent
 back
 to the browser.


 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  On Fri, Jan 22, 2010 at 2:22 AM, Marius marius.dan...@gmail.com wrote:
 
   This same thing is also touched by
 http://reviewboard.liftweb.net/r/184/
   (driven by Kris' post)
  
   Do you agree with these following statements:
  
   1. The SHtml Ajax function should return JsCmd
  
 
  Yes.
 
 
   2. The SHtml non Ajax function should return a Unit instead of Any
   (unless there are compelling reasons to keep Any)
  
 
  There is a compelling reason to keep Any.  I can't remember it right now,
  but there is a really, really good reason (I've made the change to Unit
 in
  the past and it broke a pile of stuff in my applications.)
 
 
  
   If so I could probably make the adjustments today since I'm on that
   defect anyways.
  
   Br's,
   Marius
  
   On Jan 22, 5:48 am, David Pollak feeder.of.the.be...@gmail.com
   wrote:
On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
   
felipero.maill...@gmail.com wrote:
 That's a little better.. thanks
   
Originally, the function returned Any... and this led to problems
  (people
returning HTML, Strings, etc.)  It turns out that 95% of the time,
 you
   want
to do something to tell the user that the server did something
 (unless
   the
function sends a message to a CometActor), so using the type-system
 to
   make
sure Ajax functions returned JsCmds was the right answer.
   
   
   
   
   
 greekscala wrote:
   
 Hello,
   
 know what you mean. You can use JsCmds._Noop to return nohting
 as
 JsCmd.
   
 best regards
   
 On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
 wrote:
   
 Here is how I made it, but seems ugly:
   
 SHtml.a(() = {serverSideFunction(t.text); Call(void,
  Num(0)).cmd},
   t)
   
 It is awkward having to add a JsCmd even when I don't need it.
   
 Felipe
   
 Naftoli Gugenheim wrote:
   
 Never mind my question; I hadn't paid attention to the subject.
  -
 Felipe Rodriguesfelipero.maill...@gmail.com wrote:
  Hi all,
  I want to create a link which when clicked calls a server
  side
 function.
 No need for JavaScript callback.
 I tried with no success:
  SHtml.a(() = {serverSideFunction(t.text)}, t)
  Any idea how can I accomplish that will be appreciated.
  Thanks,
  Felipe
   
 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
  
   liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
  liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 liftweb%25252bunsubscr...@googlegroups.comliftweb%2525252bunsubscr...@googlegroups.com
 
  
   
 .
 For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.
   
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
  
   --
   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
   

Re: [Lift] Re: Simple Ajax call to server side function

2010-01-21 Thread David Pollak
On Mon, Jan 18, 2010 at 10:31 AM, Felipe Rodrigues 
felipero.maill...@gmail.com wrote:

 That's a little better.. thanks


Originally, the function returned Any... and this led to problems (people
returning HTML, Strings, etc.)  It turns out that 95% of the time, you want
to do something to tell the user that the server did something (unless the
function sends a message to a CometActor), so using the type-system to make
sure Ajax functions returned JsCmds was the right answer.



 greekscala wrote:

 Hello,

 know what you mean. You can use JsCmds._Noop to return nohting as
 JsCmd.

 best regards

 On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
 wrote:


 Here is how I made it, but seems ugly:

 SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

 It is awkward having to add a JsCmd even when I don't need it.

 Felipe

 Naftoli Gugenheim wrote:


 Never mind my question; I hadn't paid attention to the subject.
  -
 Felipe Rodriguesfelipero.maill...@gmail.com wrote:
  Hi all,
  I want to create a link which when clicked calls a server side
 function.
 No need for JavaScript callback.
 I tried with no success:
  SHtml.a(() = {serverSideFunction(t.text)}, t)
  Any idea how can I accomplish that will be appreciated.
  Thanks,
  Felipe



 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
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.



[Lift] Re: Simple Ajax call to server side function

2010-01-18 Thread greekscala
Hello,

know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.

best regards

On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
 Here is how I made it, but seems ugly:

 SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

 It is awkward having to add a JsCmd even when I don't need it.

 Felipe

 Naftoli Gugenheim wrote:
  Never mind my question; I hadn't paid attention to the subject.

  -
  Felipe Rodriguesfelipero.maill...@gmail.com wrote:

  Hi all,

  I want to create a link which when clicked calls a server side function.
  No need for JavaScript callback.
  I tried with no success:

  SHtml.a(() = {serverSideFunction(t.text)}, t)

  Any idea how can I accomplish that will be appreciated.

  Thanks,

  Felipe
-- 
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.




Re: [Lift] Re: Simple Ajax call to server side function

2010-01-18 Thread Felipe Rodrigues

That's a little better.. thanks

greekscala wrote:

Hello,

know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.

best regards

On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
  

Here is how I made it, but seems ugly:

SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

It is awkward having to add a JsCmd even when I don't need it.

Felipe

Naftoli Gugenheim wrote:


Never mind my question; I hadn't paid attention to the subject.
  
-

Felipe Rodriguesfelipero.maill...@gmail.com wrote:
  
Hi all,
  
I want to create a link which when clicked calls a server side function.

No need for JavaScript callback.
I tried with no success:
  
SHtml.a(() = {serverSideFunction(t.text)}, t)
  
Any idea how can I accomplish that will be appreciated.
  
Thanks,
  
Felipe
  


--
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.