handle autocomplete by name or id