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>