I think this: def analyze_form_widget(field, value): return INPUT(_destination=field.name, _value=value,requires=field.requires)
should be def analyze_form_widget(field, value): return INPUT(_name=field.name, _value=value,requires=field.requires) On Feb 6, 4:59 pm, Tomas Pelka <tompe...@gmail.com> wrote: > Hi, > have a problem with validator in combination with custom widget. > > in model: > def analyze_form_widget(field, value): > return INPUT(_destination=field.name, _value=value, > requires=field.requires) > > in controller: > def form_factory(*a): > return SQLFORM(SQLDB(None).define_table(*a)) > > def index(): > analyze_form = form_factory('analyze_form', > SQLField('destination','string', label='Destination IP > adress', default='IP Address', requires=IS_IPV4(), > widget=analyze_form_widget)) > return dict(analyze_form=analyze_form) > > in view: > {{=analyze_form}} > > Validator always pass, analyze_form.vars always include [{'id':"1"}] and > no accepted value (even if it pass validator). Without widget > everything works fine. > > Second question, how to create widget for button like in > SQLField('destination','string', label='Destination IP adress', > default='IP Address', requires=IS_IPV4(), widget=analyze_form_widget)). > > Thanks for your advice, have a nice day. > > -- > Tom -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.