Hi,
I'm developping a tool to fill a pruchase request. Then it will be sent, sign , ...
First step : design the database (it's done, under MSSQL), draw the form, and fill it.
When the use arrive to the field "Supplier", sometime he knows it and its code, sometime he know about its name but not its code, sometime its not his job to know the suppliers.
In the first version of my app, I choose a
requires = IS_IN_DB(db(db.Suppliers.active=='Actif'),db.Suppliers.Code, '%(Code)s %(Name)s - %(City)s')
It works well (even with 4000 suppliers). BUT the user must know a supplier. He cannot leave this field empty, He cannot type something else.
In the second version, I discover the
widget=SQLFORM.widgets.autocomplete(request, db.Suppliers.Code)
It's goog to leave the field blank, or to type someting like "the company who absorb my old supplier" (INMAC / WSTORE).
BUT I get many inconvenients :
* I cannot filter the active suppliers
* I have to give the name of a field, I cannot build a combined field (like
'%(Code)s %(Name)s - %(City)s')
* It takes a while before print aech letter on the screen, after 2 letters the field lose the focus (I have to click in the field, add a letter, click again, add a letter), and (because the focus have been lost) if I type <bacspace> the system go a page back (the page site before I began to fill my form).
Probably the solution is between the two versions :
* either IS_IN_BD, with on "IS_OPTIONNAL" option
* or Autocomplete, but with the possibility to filter, to format the output, and to keep the focus while typing.
Thank you all for this nice tool and nice forum.
I discover web2py for 2 months, and my first app already makes some nice things => insert PurchaseRequests, update PR, validate PR, send PR to a buyer, store one or more attached to a PR, ... Next step : manage the workflow of the PR => who validate, in witch case, is there a condition, condition about the price, about the category of pieces (chemical, )