I used your suggest, without success. My code: form = SQLFORM.factory ( Field('test1','string', widget=mywidget, default='...'), Field('test2','string', widget=mywidget, default='...'), )
def mywidget(field, value): _id = '%s_%s' % (field._tablename, field.name) _name = field.name ...... lst = _funcxxx(value) script = SCRIPT(......) select = SELECT( lst, _name=_name, _id=_id, _class=field.type, _value=value, _onchange="javascript: getcontent();" ) return DIV(select, script) form.vars ---> <Storage {'id': 1}> after form.accepts values of testx are correctly stored in request.vars Where is my error???? Thanks On 13 Giu, 04:04, "mr.freeze" <nat...@freezable.com> wrote: > Here are some examples that may > help:http://www.web2pyslices.com/main/default/search?query=7&criteria=cate... > > As Iceberg says, your widget must have the proper attributes to be > accepted by form.accepts. I like to render the field using the default > widget then modify it. This way I know it has the proper attributes. > > def my_widget(f,v): > inp = SQLFORM.widgets.string.widget(f,v) #or another depending on > field > scr = SCRIPT('...',_type=''text/javascript') > return DIV(inp,scr) > > On Jun 11, 11:47 pm, leone <handja...@gmail.com> wrote: > > > > > I coded a widget to use with a Field object. > > Because I need some javascript actions i wrote pure html-javascript > > code that my widget returns. > > It runs, but when I accept the form values are in request.vars, but > > not in form.vars. > > How can i store values in form.vars without using input widgets > > defined by SQLFORM.widgets...? > > Thanks in advance > > leone