Sorry I cannot find action "empreiteiro" On Friday, 5 April 2013 16:45:39 UTC-5, Ramos wrote: > > I post here my app. > > Sorry about the quality of my code. I´m learning as i go along the way. > > The problem is in controller default, action empreiteiro > > The upload field is required but when i edit a record i see the link to > the uploaded file and if i do nothing and just save it complains that i > have to upload a file. > It is there!! > > Thank you > > António > > > > 2013/4/5 Massimo Di Pierro <massimo....@gmail.com <javascript:>> > >> 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 web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > >
-- --- 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. For more options, visit https://groups.google.com/groups/opt_out.