I've run into an odd problem with autocomplete:
I have a factory form doing an autocomplete lookup on the field
idb.module.code, with custom help_fields, etc., and it works well:
browseform = SQLFORM.factory(Field('code', widget=SQLFORM.widgets.
autocomplete(request, idb.module.code, id_field=idb.module.id,
orderby=
idb.module.code, min_length=2,
help_fields=[idb.module.code, idb.module.title],
help_string='%(code)s - %(title)s')),
...
)
Until, that is, I define an autocomplete in my model for another field,
which does lookup on the same field:
idb.define_table(
'module',
Field('id', 'id', readable=False),
Field('code', 'string'),
Field('sourcemodulecode')
...
)
idb.module.sourcemodulecode.widget = SQLFORM.widgets.autocomplete(request,
idb.module.code, min_length=3,
id_field=
idb.module.code, help_fields=[idb.module.title],
help_string='This should not show up in the factory form, but does.')
Now the output of the factory form's field becomes 'This should not show up
in the factory form, but does.'
Am I messing something up in my implementation?
An aside: is there solid documentation of help_fields and help_string
anywhere? They do exactly what I want, but I only stumbled upon them while
looking through the source code.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.