Using the form wizard, user inputs values into fields and upon completion of form is redirected to sqlform.grid page, where the uploaded file can be viewed, this all works. The problem is when I try to view the database I get this error:
* def formatter(self,value): return '%.2f' % valueTypeError: float argument required, not str* This was not a problem until I implemented the form wizard, I can't figure out what is causing it. *Models:*from decimal import * class IS_MYDECIMAL(IS_DECIMAL_IN_RANGE): def formatter(self,value): return '%.2f' % value db.define_table('tablecosts', Field('yourname', 'string', requires=IS_NOT_EMPTY(), label='Your name:'), Field('thedate', 'date', requires=IS_DATE(format='%m-%d-%Y', error_message=T('Enter date in the format: mm-dd-yyyy')), label='Report date:'), Field('num1', requires=IS_MYDECIMAL(None,None), label='first:'), Field('num2', requires=IS_MYDECIMAL(None,None), label='second:'), Field('num3', requires=IS_MYDECIMAL(None,None), label='third:'), Field('num4', requires=IS_MYDECIMAL(None,None), label='fourth:'), ##there are a lot more fields but this is the gist of it, to keep the post short Field('costs_file', 'upload', compute=costs_calc), Field('created_by', 'reference auth_user', default=auth.user_id, readable=False, writable=False)) *Controller:* @auth.requires_login() def tablecosts(): STEPS = {0: ('yourname', 'thedate'), # fields for 1st page 1: ('num1', 'num2', 'num3'), # fields for 2nd page 2: ('num4'), #fields for 3rd ##this goes on for a few pages with more fields 6: URL('costslist')} # url when wizard completed step = int(request.args(0) or 0) if not step in STEPS: redirect(URL(args=0)) fields = STEPS[step] print "Fields: " + str(fields) + " Step " + str(step) if step==0: session.tablecosts = {} if isinstance(fields,tuple): form = SQLFORM.factory(*[f for f in db.tablecosts if f.name in fields]) if form.accepts(request,session): session.tablecosts.update(form.vars) redirect(URL(args=step+1)) else: db.tablecosts.insert(**session.tablecosts) session.flash = T('form completed') redirect(fields) return dict(form=form,step=step) def done(): return dict(message="End of form", back=A("New form", _href=URL("costslist"))) @auth.requires_login() def costslist(): grid = SQLFORM.grid(db.tablecosts.created_by == auth.user_id, fields=[db.tablecosts.yourname, db.tablecosts.thedate, db.tablecosts.costs_file]) return locals() If the user enters 10, it becomes 10.00 and if they enter 5.00 it stays 5.00. When I open the uploaded file, it works and shows this. However, since implementing form wizard it does not allow me to view db because of it, I am confused because it worked fine before. -- 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. For more options, visit https://groups.google.com/d/optout.