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

or

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

On Oct 17, 2:50 pm, "david.waldrop" <david.wald...@gmail.com> wrote:
> some minor progress.  The following now lets thge loaded component
> work, but does not do the autocomplete .
>
>     addform =
> SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(request,
> db.cat.name, id_field=db.cat.id) )
>
> Is there something special I need to do to get the autocomplete to
> work inside a loaded component?
>
> On Oct 17, 2:24 pm, "david.waldrop" <david.wald...@gmail.com> wrote:
>
> > 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" <david.wald...@gmail.com> 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