One question related to the A() callback.

Defining a <div id="some_id"> </div> and adding a target="some_id" to
the A works very well.

I tried to do session.flash/response.flash inside the callback
function but it didn't work. Is there a way to do it?

def callback_function():
    it does some stuff...
    if s == "1":
        return something
    elif s == "2":
        return something else
    else:
        session.flash = "Message"
        return ???
Is this possible???

On Dec 6, 4:12 pm, Anthony <abasta...@gmail.com> wrote:
> On Dec 6, 9:49 am, thodoris <pasxi...@gmail.com> wrote:
>
> > I didn't know about the callback argument. Thanks a lot for the tip.
> > In the above case then it is not necessary then.
> > I was going to use something quite complicated for something simple.
> > Is it possible for the callback to affect multiple fields, or else
> > what happens if there are fields with the same "id" ??
>
> In HTML, dom elements should not share the same "id". But if you need
> to update multiple divs, I suppose you could instead have the link
> click trigger a call to web2py's ajax() function, which can take
> ':eval' as the target -- you can then return some JS, which will get
> evaluated when returned (the JS can update multiple targets). 
> Seehttp://web2py.com/book/default/chapter/10#Eval-target.
>
> Anthony

Reply via email to