From 6050a0a251a5da5236ba947581171b5eea470470 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 9 Oct 2012 11:41:34 -0400 Subject: [PATCH] Advance focus to the next input field after autocompleting class or instance. (imported from commit 068009946f0581834e268f1ed3d5e7e6a940fcde) --- templates/zephyr/home.html | 4 ++-- zephyr/static/js/ui.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/zephyr/home.html b/templates/zephyr/home.html index 52b1dc45eb..0de319f6db 100644 --- a/templates/zephyr/home.html +++ b/templates/zephyr/home.html @@ -39,10 +39,10 @@ - + - + diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index 9d2a834961..ea4a74af68 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -16,6 +16,16 @@ function register_onclick(zephyr_row, zephyr_id) { }); } +function focus_on(field_id) { + // Call after autocompleting on a field, to advance the focus to + // the next input field. + + // Bootstrap's typeahead does not expose a callback for when an + // autocomplete selection has been made, so we have to do this + // manually. + $("#" + field_id).focus(); +} + /* We use 'visibility' rather than 'display' and jQuery's show() / hide(), because we want to reserve space for the email address. This avoids things jumping around slightly when the email address is shown. */