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.htm section "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

Reply via email to