== IS_ONE_OF_EMPTY == == validator == This one has all properties of [wiki:IS_ONE_OF IS_ONE_OF] but one: it '''does not''' send back to the browser a '''potentially huge''' dropdown with all values.[[BR]] Instead, it creates the INPUT box which can carry the corresponding lookup id.[[BR]] And when the form gets sent back to the server, the content of this INPUT box gets validated on the server against the corresponding lookup table. '''How to use the IS_ONE_OF_EMPTY?''' '''1. Controller''' Keep in mind that the corresponding model assumes ''default validator'' against the organisation_id. The working example is [http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/annotate/569/controllers/or.py controllers/or.py]: here the organisation_id is not mandatory, but: if present, must be validated against the (large) organisation table. {{{ def office(): ... # the update forms are not ready. when they will - uncomment this and comment the next one #if request.args(0) in ("create", "update"): if request.args(0) == "create": db[table].organisation_id.requires = IS_NULL_OR(IS_ONE_OF_EMPTY(db, "or_organisation.id")) ... }}} '''Note:''' the method ''update'' has a separate view file, and as of now it is not having the auto-complete functionality yet. Once it is ready, the line {{{ if request.args(0) in ("create", "update"): }}} will replace the existing one, taking care of just ''create'': {{{ if request.args(0) == "create": }}} '''2. View - Auto-complete''' And the complimentary view [http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/annotate/569/views/or/office_create.html or/office_create.html] {{{ }}} ............(back to DeveloperGuidelinesTips)..............