I have now tried this

    addform =
SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
db.cat.name, id_field=db.cat.id) )

but it doesn't work either.

On Oct 17, 10:58 am, "david.waldrop" <[email protected]> wrote:
> I have a form created with SQLFORM.factory containing a single field
>
>     addform = SQLFORM.factory(Field('item_cat'))
>
> Is there a way to use the autocomplete widget.  I have searched and
> seen examples where I set the widget in the model, but do cannot find
> an example of how to associate the autocomplete widget with a field
> when using SQLFORM.factory.
>
> I did get it to work in the model bu using something like the
> following: db.itemcat.cat_ref.widget =
> SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> I am sure someone has done this and very much would love to see an
> example.

Reply via email to