Reload form.custom.inpval after save form

8

I'm developing a web2py system and I have the following question:

I made a custom form that has a field that sends a preview image. The code looks like this:

{{=data['form'].custom.begin}}

    {{dsp = data['form'].custom.dspval}}
    {{inp = data['form'].custom.inpval}}
    {{lbl = data['form'].custom.label}}
    {{wid = data['form'].custom.widget}}

    .
    .
    .
    {{=B(lbl.logo)}}
    {{=wid.logo}}
    {{if inp.logo != '':}}
        <br /><img src="{{=URL('static', 'upload/empresa/logo/'+inp.logo)}}" width="120" />
    {{pass}}
    .
    .
    .

{{=data['form'].custom.end}}

db.py looks like this:

.
.
Field('logo',
    label='Logo',
    type="upload",
    uploadfolder=os.path.join(request.folder,'static/upload/empresa/logo'),
    autodelete=True
),
.
.

When I run form, web2py does not update the value of inp.logo , only when I reload the view.

The wid.logo brings the input, so it does not serve as a preview of the image. How do I reload inp.logo ?

    
asked by anonymous 06.06.2014 / 05:45

0 answers