Can you post a simpler example (including mode) to reproduce the problem?
Looks like the field in the table has a validator which requires an upload.
On Friday, 5 April 2013 11:06:52 UTC-5, Ramos wrote:
>
> hello, i´m using a sqlform.factory to edit a record.
>
> The form is prepopulated using this code
>
>
> row=db((db.trabalhador.id==request.args(0))).select().first()
>
> if row:
> for field in row:
> if field in db.trabalhador.fields:
>
> print "setting -",row[field] ," on ",field
> db.trabalhador[field].default=row[field]
>
>
> one of the fields is a required upload field.
>
> The rest of the code
> form=SQLFORM.factory(db.trabalhador,db.t_docs,
> submit_button="Gravar",
>
> fields=['nome','bi','ncart','ncartval','rfid','apt_medica','apt_medicaval','val_formacao','f_doc'],
> table_name='trabalhador',
> upload=URL('download')
> )
> empresa=request.vars['id'] or empresa
> extra_but = TR(DIV(A(I(_name='but',_class='icon-camera icon-white'),'
> Tirar foto',_class="btn btn-primary",_id ="but")))
> extra_fp_url =
> TR(DIV(INPUT(_name='fp_url',_type='hidden',_id='fpurl')))
> extra_Aptidao = TR(DIV(A(I(_name='but',_class='icon-file
> icon-white'),' ',_class="btn
> btn-primary"),_onclick="location.href='"+URL(f='download',
> args=form.vars.apt_medica)+"'"))
> form[0].insert(-4,extra_Aptidao)
> form[0].insert(-1,extra_but)
> form[0].insert(-1,extra_fp_url)
>
> if form.process().accepted:
> print "accepted form to save or update"
> print form.vars
>
>
>
> When i edit a record i see the upload file. But if i do not change the
> upload and save the record i get the error asking me to add the upload file.
>
> I need some help on this.
> Thank you
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.