Related to the issue above. I have the following form:

form = SQLFORM.factory(table, db.prm_generic, upload=URL('default', 
'download'), buttons=buttons)
...
if form.validate():
        if request.args(0) == 'landingpages':
            if row:
                row.update_record(**db.prm_page._filter_fields(form.vars))
                
sub.update_record(**db.prm_generic._filter_fields(form.vars))
            else:
                form.vars.pageid = 
db.prm_page.insert(**db.prm_page._filter_fields(form.vars))
                
db.prm_generic.insert(**db.prm_generic._filter_fields(form.vars))

When I prepopulate the form, the form does not contain the file link and it 
does not display
the image. It just contains the browse button.

When I submit the form, without adding an image I get the following error:


Ticket ID 

127.0.0.1.2020-11-11.18-02-47.b218631d-6dc1-42b1-af58-3f68e9641716
<class 'RuntimeError'> Unable to handle upload Version web2py™ 
Version 2.20.4-stable+timestamp.2020.05.03.05.18.50 Traceback 

The upload field is in 
sub.update_record(**db.prm_generic._filter_fields(form.vars))

Why doesn't web2py handle this properly?

KInd regards,

Annet


Op woensdag 11 november 2020 om 17:04:00 UTC+1 schreef Annet:

> When I create a form based on a table that has a field of type upload
> to upload an image, I have a problem when one of the other fields
> in the table doesn't validate. e.g. a field of type text contains too
> may characters.
>
> This form.errors resets the upload field, so I have to browse for
> the image again, every time one of the other fields doesn't
> validate.
>
> I haven't noticed this behaviour in version 2.14 of web2py, I
> am experiencing this behaviour in web2py 2.20.
>
> I hope there's an easy fix, for this is very annoying.
>
>
> Kind regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d93e626d-fc74-4fc8-8d9f-8cff6d4d5e3an%40googlegroups.com.

Reply via email to