Is there a togglable ajax button in lift?

20 views
Skip to first unread message

Jonathan Ferguson

unread,
Nov 24, 2009, 6:23:34 PM11/24/09
to lif...@googlegroups.com
I've looked through the API and couldn't find anything that seemed suitable.

We need an ajax button that when clicked will fire an event to the server and then toggle the button text. This could be by having two different buttons and only showing one. 

Cheers 
Jono

Derek Chen-Becker

unread,
Nov 25, 2009, 10:04:42 AM11/25/09
to lif...@googlegroups.com
I haven't tried it, but I'm pretty sure that if you give the button an id you should be able to fire the text change from the AJAX handler. Something like:

import net.liftweb.http.js._
import JE._

SHtml.ajaxButton("Click me!", () => { doSomethingServerSide(); JsCmds.SetElemById("myButton", "Click me again!", "innerHtml")}, "id" -> "myButton")

That's off the top of my head, so let me know if that doesn't work.

Derek

--

You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Jonathan Ferguson

unread,
Nov 25, 2009, 6:13:40 PM11/25/09
to lif...@googlegroups.com
Will have a look over the next few days. 

Thanks you very much.

Jono

2009/11/26 Derek Chen-Becker <dchen...@gmail.com>
Reply all
Reply to author
Forward
0 new messages