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 <[email protected]> > 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.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 images:}} >> <image><img width="85px" >> src="{{=URL('download', args=img.file)}}" /><br></image> >> <br><br><br><br><br> >> {{=img}} >> {{=img.id}} >> {{=form}} >> {{pass}} >> >> 2012/3/11 juvi1 <[email protected]> >> >>> 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.id,**db.ref.file) >>> for img in images: >>> formname = "upload_f_%s"%img.id >>> form = FORM(INPUT(_type="file",_name=**formname), >>> INPUT(_type='submit')) >>> >>> if form.accepts(request.vars, _name=formname): >>> response.flash = form.vars >>> >>> return dict(form=form, img=img, formname=formname, images=images) >>> >>> in views: >>> {{for img in images:}} >>> <image><img width="85px" >>> src="{{=URL('download', args=img.file)}}" /><br></image> >>> <br><br><br><br><br> >>> {{=img}} >>> {{formname=img.id}} >>> {{=formname}} >>> {{=form}} >>> {{pass}}{{pass}} >>> >>> please help! >>> >> >> >> >> -- >> http://www.tecnodoc.com.ar >> >> -- http://www.tecnodoc.com.ar

