Hi Massimo, will this issue be addressed in coming web2py 1.98.1? Thanks in advance.
Ray On Jul 24, 10:29 pm, Iceberg <[email protected]> wrote: > I prefer to use crud, but it is not qualified for your workaround I > think. > > On the other hand, you said that there is a "custom" widget which > interfere with validators. Is it possible that I switch "back" to an > old style widget, which respects validators? Because I need server > side validation more than an appealing UI. > > I've tried this, still no luck. When submit, ticket occurs. Do you see > a chance here? > > ... > Field('participants', 'list:reference employee', > requires = [IS_NOT_EMPTY(), > > IS_LIST_OF(IS_IN_DB(db,'employee.id',db.employee._format,multiple=True))], > widget = SQLFORM.widgets.list.widget, # default is "multiple" > widget > ) > > Regards, > Ray > > On Jul 24, 9:54 pm, Massimo Di Pierro <[email protected]> > wrote: > > > > > > > > > try one more thing: > > > form = SQLFORM(....) > > form.element('input#appointment_participants') > > ['requires']=IS_NOT_EMPTY() > > if form.accepts(...) > > > The problem is that the custom widget interfere with validators and > > validators may have to be attached to the widget. > > > On Jul 24, 8:22 am, Iceberg <[email protected]> wrote: > > > > Hi Massimo, > > > > Thanks for trying to help. Perhaps I did not clearly explain the > > > point. > > > > I hope to add an IS_NOT_EMPTY() constraint to any "list:reference > > > table_name" field. My previous snippet is copied from web2py book, but > > > in my real need, that "list:reference" field is not necessary a tag. > > > So I'm not going to plugin_tagging or plugin_wiki direction. Instead > > > you can think about a booking system inside a company. > > > > db.define_table('employee', Field('name')) > > > db.define_table('appointment', > > > Field('subject', 'string'), > > > Field('participants', 'list:reference employee'), > > > ) > > > > So I don't need any comma-separated-employee-name UI. In fact the > > > default widget for list:reference is already great. What I need is > > > just make sure any appointment will have at least one participant. > > > > Can we somehow hook a IS_NOT_EMPTY() into list:reference 's default > > > widget? Thanks! > > > > Regards, > > > Ray (a.k.a. Iceberg)

