I have the following function:

def index():
    form1=SQLFORM.factory(
 
Field('what',widget=SQLFORM.widgets.autocomplete(request,db.companykeyword.word))
 
Field('city',widget=SQLFORM.widgets.autocomplete(request,db.adres.plaats)))
    form2=SQLFORM.factory(
 
Field('what',widget=SQLFORM.widgets.autocomplete(request,db.companykeyword.word)),
 
Field('zip',widget=SQLFORM.widgets.autocomplete(request,db.zip.region)))
    form3=[]
    if form1.accepts(request.vars,session,formname='form1'):
        redirect(URL(r=request,c='locator',f='city',args=[]))
    if form2.accepts(request.vars,session,formname='form2'):
        redirect(URL(r=request,c='locator',f='zip',args=[]))
    return dict(form1=form1,form2=form2,form3=form3)

and the following view:

<div class="threeColLayout">
  <div class="secondCol" class="margin">
    {{if form2:}}
      <div class="colbox">
        {{=form2}}
      </div> <!-- colbox -->
    {{pass}}
  </div> <!-- secondCol -->
  <div class="thirdCol" class="margin">
    {{if form3:}}
      <div class="colbox">
        {{=form3}}
      </div> <!-- colbox -->
    {{pass}}
  </div> <!-- thirdCol -->
  <div class="firstCol" class="margin">
    {{if form1:}}
      <div class="colbox">
        {{=form1}}
      </div> <!-- colbox -->
    {{pass}}
  </div> <!-- firstCol -->
</div> <!-- threeColLayout -->


The problem is that form2's companykeyword auto-complete works and
form1's doesn't work. The city and zip auto-complete's both do work.

Does this mean I can't have two auto-complete fields in separate forms
based on the same database table? Is there a way to solve this
problem?


Kind regards,

Annet.

Reply via email to