I'm a web2py (2.4.16) newbie and I would like to show a SQLFORM inside a modal div container using stupid.css. however I cannot make it work.
stupid.css works well (orange buttons) but when clicking on buttons nothing happens…
My next step would be to css-customize the SQLFORM. Can somebody please guide me to some reference or examples?
/*
models/db.py
*/
# -*- coding: utf-8 -*-
db.define_table("thing",
Field("name", "string"))
/*
controllers/default.py
*/
# -*- coding: utf-8 -*-
def index():
return locals()
def add():
form = SQLFORM(db.thing)
if form.process().accepted:
response.flash = "item added."
redirect(URL('index'), client_side=True)
return locals()
def edit():
this_item = db.thing(request.args(0, cast=int)) or redirect('index')
form = SQLFORM(db.thing, this_item)
if form.process().accepted:
response.flash = "item updated."
redirect(URL('index'), client_side=True)
return locals()
/*
views/default/index.html
*/
{{extend 'layout.html'}}
list of things: <br>
<ul>
{{for thing in things:}}
{{=LI(A(
thing.name, _href=URL('edit', args=
thing.id), _class="btn orange", cid='editPanel'))}}
{{pass}}
</ul>
<div id="btAddNew">
{{=A('add new ...', _href=URL('add'), cid='editPanel')}}
</div>
<div id="editPanel">
<h2>edit</h2>
<div class="modal" name="formgoeshere"></div>
<a href="#" class="close">x</a>
</div>
/*
views/default/add.html
*/
{{=form}}
/*
views/default/edit.html
*/
{{=form}}