samedi 25 mai 2019

How to filter out a single, specfic value in the autopopulate using IF condition

What would be the if statement code for filtering out a single word example "Generic" so it will not show on the auto populate field?

I don't have a clue on what if statement codes shall I use.

function autocompleteDrugs($input, onSelect, onSelectNone) {
    $input.autocomplete({minLength:3,delay: 200,source: function(request, response) {
        DWRCHITSConceptService.findDrugs(request.term, function(drugs) {
                $j.each(drugs, function() { this.label = this.name; this.value = this.label })
                response(drugs.length > 0 ? drugs : [{label:'Add non-formulary drug: ' + request.term, value: ''}])
            })
        }, select: function(event, ui) {
            if (ui.item.drugId > 0) {
                if ($j("tr.drug-" + ui.item.drugId).size() == 0) { 
                    onSelect(ui.item.drugId, ui.item.label) }
            } 
            else {
                onSelectNone("1","","","||"+$input.val());
            }
            $input.val("")
            return false;
        }
    })
}

Aucun commentaire:

Enregistrer un commentaire