Commit 629a3908 authored by haemmer's avatar haemmer

Implemented #2077

parent 9ba94e07
...@@ -42,6 +42,9 @@ var KEY_PRESS_FILTER_DELAY_MS = 120; ...@@ -42,6 +42,9 @@ var KEY_PRESS_FILTER_DELAY_MS = 120;
var resizeHandlerSet = false; var resizeHandlerSet = false;
var suspendTextBoxExitHandler = false; var suspendTextBoxExitHandler = false;
// Stores number of entries that matched for text
var matchedEntries = 0;
(function ($) { (function ($) {
$.fn.improveDropDown = function (value) { $.fn.improveDropDown = function (value) {
if (!resizeHandlerSet) { if (!resizeHandlerSet) {
...@@ -183,8 +186,10 @@ function getTextElement(sourceElement, imgElement) { ...@@ -183,8 +186,10 @@ function getTextElement(sourceElement, imgElement) {
case KEY_ESCAPE: closeListUndoTyping(thisTextElement); break; case KEY_ESCAPE: closeListUndoTyping(thisTextElement); break;
case KEY_TAB: break; case KEY_TAB: break;
case KEY_ENTER: case KEY_ENTER:
// Move focus on submit button // Submit if only one entry matches
$('[type="submit"]').focus(); if (matchedEntries == 1) {
$('[type="submit"]').click();
}
break; break;
case KEY_DOWNARROW: break; case KEY_DOWNARROW: break;
case KEY_UPARROW: break; case KEY_UPARROW: break;
...@@ -377,7 +382,7 @@ function populateListItem(newListControl, optionItem) { ...@@ -377,7 +382,7 @@ function populateListItem(newListControl, optionItem) {
newListItem.mouseout(function () { $(this).removeClass('idd_listItem_Hover'); }); newListItem.mouseout(function () { $(this).removeClass('idd_listItem_Hover'); });
newListItem.click(function () { newListItem.click(function () {
selectItem($(this),true,true,false); selectItem($(this),true,true,false);
$('[type="submit"]').focus(); $('[type="submit"]').click();
}); });
} }
else { else {
...@@ -444,6 +449,9 @@ function getBestMatch(value, listControl) { ...@@ -444,6 +449,9 @@ function getBestMatch(value, listControl) {
var bestMatchElement; var bestMatchElement;
// Store matched entries
matchedEntries = filterMatches.length;
switch (filterMatches.length) { switch (filterMatches.length) {
case 0: bestMatchElement = null; break; case 0: bestMatchElement = null; break;
case 1: bestMatchElement = filterMatches.first(); break; case 1: bestMatchElement = filterMatches.first(); break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment