<https://lh4.googleusercontent.com/-C5e04mE4s8I/T13jl7HXizI/AAAAAAAAAAU/ngyK-9pCkAA/s1600/Screenshot%2520at%25202012-03-12%252013%253A51%253A57.png>
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 that insert always image_id variable = last image 
id in database.
def jobs():
    images=db().select(db.ref.id,db.ref.file)
    for img in images:
        form = SQLFORM(db.ref, img.id)  
     
    if form.process().accepted:
        response.flash = "Image uploaded"+str(form.vars)
    else:
        response.flash = form.vars.id
                
    return dict(form=form, images=images)

maanantaina 12. maaliskuuta 2012 12.23.36 UTC+2 Martin.Mulone kirjoitti:
>
> 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
>
>  

Reply via email to