Aha! I don't normally use 'zero=None'. Maybe I should. Thank you very much DenesL.
On Mar 23, 6:23 pm, DenesL <denes1...@yahoo.ca> wrote: > On Mar 23, 3:35 am, niknok <nikolai...@gmail.com> wrote: > > > Thanks for asking the right question. When I saw "define", I took a > > look into the code and noticed that I left it undefined, even with a > > requires = ..., it's still defaulted to a string type. > > > I just tryied the radioboxes but I'm getting an extra radio button > > displayed and some fluff. I edited out the nbsp but still getting the > > extra radio button. > > The nbsp are there just to create some spacing. > To remove the extra radio button you have to specify > zero=None > when you define your options, e.g. > requires=IS_IN_SET(['A','B','C'], zero=None) > > > > > > > > > def radioboxes(field,value): > > > items=[SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=valu > > e)) > > for key,name in field.requires.options()] > > return DIV(*items) > > > The error I posted did not occur again. Probably related to the test > > data I was making. After rebuilding the db, it didn't show itself > > again. [crossing my fingers..] > > > On Mar 23, 10:28 am, DenesL <denes1...@yahoo.ca> wrote: > > > > Hi, > > > > On Mar 22, 9:39 pm, niknok <nikolai...@gmail.com> wrote: > > > > > Hi everyone. > > > > > a few question about forms: > > > > 1. why doesn't the datepicker appear when I use the sqlform.factory to > > > > generate input fields? > > > > It works for me. > > > How did you define the field?. > > > Are you using the default layout?. > > > > > 2. Other than customizing a view, is there a way to display radiobox > > > > options horizontally when using sqlform? > > > > Yes, with widgets, for example: > > > > def radioboxes(field,value): > > > nbsp = XML(' ') > > > items=[TAG[''] > > > (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)), > > > nbsp, nbsp ) > > > for key,name in field.requires.options()] > > > return DIV(*items) > > > > and in the field definition just add > > > widget=radioboxes > > > > > I'm stuck with this "internal error": ValueError: invalid literal for > > > > int() with base 10: '' > > > > > Traceback (most recent call last): > > > > File "/home/rwn/Projects/web2py/gluon/restricted.py", line 188, in > > > > restricted > > > > exec ccode in environment > > > > File "/home/rwn/Projects/web2py/applications/bbc_test/views/ > > > > appadmin.html", line 193, in <module> > > > > </p> > > > > File "/home/rwn/Projects/web2py/gluon/sqlhtml.py", line 1356, in > > > > __init__ > > > > r = A(field.represent(r), _href=str(href)) > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 3322, in > > > > repr_ref > > > > def repr_ref(id, r=referenced, f=ff): return f(r, id) > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 3291, in ff > > > > row=r(id) > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 4243, in > > > > __call__ > > > > record = self._db(self.id == key).select(limitby=(0,1)).first() > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 5009, in select > > > > return self.db._adapter.select(self.query,fields,attributes) > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 1070, in select > > > > return self.parse(rows,self._colnames) > > > > File "/home/rwn/Projects/web2py/gluon/dal.py", line 1263, in parse > > > > colset[fieldname] = rid = Reference(value) > > > > ValueError: invalid literal for int() with base 10: '' > > > > Please post the code too, it is hard to follow with just the trace. > > > > > Am using version 1.94.5.