Hi Massimo, I'd love to hear about a more web2py-ese way to do it.
Thanks for the solution... your help is much appreciated! -Rob On Aug 7, 6:21 pm, mdipierro <[email protected]> wrote: > This is not very web2py-ese and there are simpler ways to achieve it. > Anyway. I assume the action that needs the onsuccess is implemented as > a server-side function. You can have that function set, before > retuning: > > def youraction(): > .... > response.headers['web2py-component- > command']='AnimateRSVPMessage()' > return dict(....) > > On Aug 7, 4:41 pm, Rob <[email protected]> wrote: > > > Hi, > > > In my attempts to learn, I've been redoing the NerdDinner example from > > the .NET MVC tutorial with web2py. But I'm stuck > > here:http://nerddinnerbook.s3.amazonaws.com/Part10.htmsection"Adding a > > jQuery Animation" > > > Right now my code looks like this: > > > function AnimateRSVPMessage() { > > $("#rsvpmsg").animate({fontSize: "1.5em"},400); > > > } > > > function RSVP() { > > web2py_component('{{=URL('Register', args=dinner.id)}}', 'rsvpmsg'); > > AnimateRSVPMessage(); > > > } > > > <div id="rsvpmsg"> > > {{if IsAuthenticated():}} > > {{if IsUserRegistered(dinner):}} > > <p>You are registred for this event!</p> > > {{else:}} > > <p><a href="#" onclick="RSVP()"> > > RSVP for this event</a><p> > > {{pass}} > > {{else:}} > > {{=A("Login", _href=URL('user/login'))}} to RSVP for this event. > > {{pass}} > > </div> > > > Is it possible to emulate the .NET's OnSuccess attribute: > > > <%= Ajax.ActionLink( "RSVP for this event", > > "Register", "RSVP", > > new { id=Model.DinnerID }, > > new AjaxOptions { UpdateTargetId="rsvpmsg", > > OnSuccess="AnimateRSVPMessage"}) %> > > > I'd only like to animate if web2py_component returns 'not None'. > > Possible? > > > Thanks, > > Rob

