> def create():
> form = crud.create(db.booking, next = URL('index'))
> return dict(form=form)

> So I was wondering to use a validator like this:
> db.booking.room_id.requires = IS_IN_DB(db, db.room.id, '% (name)s',multiple=True)

> But It doesn't work.

In what way doesn´t it work?

You have to put that validator before you create the form. So the create function should look like
def create():
db.booking.room_id.requires = IS_IN_DB(db, db.room.id, '% (name)s',multiple=True)
form = crud.create(db.booking, next = URL('index'))
return dict(form=form)

> And when a user saves a booking It must sent an email to an admin, the admin should validate the booking.

Maybe theres a easier way but one way could be like:
form = crud.create(db.booking, next = URL('send_email'))

and create function that sends the email, look at
http://web2py.com/book/default/chapter/08?search=mail.send#Auth-and-Mail

from this function you redirect to index.


Kenneth





So the magic question is, How could I do all above?

Thank's!!!

Reply via email to