Good evening,

I've just discovered the possibility to use in the view of the callback 
option when we want to create a link, e.g. {{=A('mypage', 
callback(URL='myfunction'), target='myID'). I found it really useful for 
not loading a new page again. The problem is that the callback calls a 
function that return a simple form that is correctly shown inside that div 
but when i press the 'submit' button... the page refresh, but nothing 
happen on the db. Basically nothing is register.

What am I doing wrong? I am not really interested in fixing this specific 
problem rather to understand how it works and what I didn't get.

Regards,

Riccardo

P.S. I attach the code if it might help:
def addPet():
    db.pet.owner_id.readable = False
    db.pet.owner_id.writable = False
    db.pet.owner_id.default = auth.user.id
    form = crud.create(db.pet, onaccept=lambda form: testAnotherFunction(
form.vars.id), next=URL('welcome'), message='The pet has been added')
    return dict(form = form)

IN THE VIEW WELCOME.HTML
...
<li>{{=A('Add a Pet', callback=URL('addPet'), target="MainContent" )}} </li>
...
<div id="MainContent">
    Replace the content
</div> 


ADDAPET.HTML
<div class="row">
        <div  class="span5 offset1"id="addPetForm" >
            {{=form}}
        </div>
</div>



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to