[web2py] using form in same page?

2012-03-11 Thread juvi1
Hello sorry my bad english and i hope that you understand my problem. I want show in one page all pictures which are saved in database. In page i want that i can upload new picture and update it whit forms (override old one) My code are in controller: def jobs(): images=db().select(db.ref.i

Re: [web2py] using form in same page?

2012-03-11 Thread Martín Mulone
I don't know why you have two {{pass}} in your view. I think you can do: def jobs(): images=db().select(db.ref.id,db.ref.file) form = SQLFORM(db.ref) if form.process().accepted: response.flash = "Image uploaded" return dict(form=form, images=images) in views: {{for img in

Re: [web2py] using form in same page?

2012-03-11 Thread juvi1
thanks, but now form create always new image in database, and i want update image. how it can be done?? sunnuntaina 11. maaliskuuta 2012 13.37.36 UTC+2 Martin.Mulone kirjoitti: > > I don't know why you have two {{pass}} in your view. I think you can do: > > def jobs(): > images=db().select(db

Re: [web2py] using form in same page?

2012-03-12 Thread Martín Mulone
To edit an image you need to pass the id of the row to SQLFORM. Ex.: row_id = 1 form = SQLFORM(db.ref, row_id) 2012/3/11 juvi1 > thanks, but now form create always new image in database, and i want > update image. > how it can be done?? > > sunnuntaina 11. maaliskuuta 2012 13.37.36 UTC+2 Martin

Re: [web2py] using form in same page?

2012-03-12 Thread juvi1
Sry. I dont understand. now all forms update same image (image_id1) can i send img_id (in view) to form (in controller)? I also try this code, but t

Re: [web2py] using form in same page?

2012-03-12 Thread juvi1
this code work but i need create form in controller but how i send the img_id variable in controller (form)? {{for img in images:}} {{=img}} {{=img.id}} {{row_id=img.id}} {{form = SQLFORM(db.ref, row_id) if form.process().accepted:

Re: [web2py] using form in same page?

2012-03-12 Thread Martín Mulone
The easy way is to add another controller "edit_image" and add a link to this in each image. (controller/default.py) def edit_image(): row_id = request.args[0] form = SQLFORM(db.ref, row_id) if form.process().accepted: response.flash = "Image uploaded" else: