NIHVIVO-749 Fixed incorrect behavior in authors form when user hits cancel button with autocomplete selections in view.

NIHVIVO-1056 Fixed first scenario, where first/middle name fields appear when autocomplete selection is made using tab.
This commit is contained in:
rjy7 2010-08-17 19:31:25 +00:00
parent 29152e8c78
commit ae3ec1d93e

View file

@ -144,7 +144,7 @@ var addAuthorForm = {
this.hideSelectedAuthor(); this.hideSelectedAuthor();
this.cancel.unbind('click'); this.cancel.unbind('click');
this.cancel.bind('click', function() { this.cancel.bind('click', function() {
addAuthorForm.showAuthorListOnlyView(); addAuthorForm.showAuthorListOnlyView();
return false; return false;
@ -498,9 +498,11 @@ var addAuthorForm = {
}); });
this.lastNameField.blur(function() { this.lastNameField.blur(function() {
// If personUri field has a value, the autocomplete select event has already fired; // Cases where this event should be ignored:
// don't do anything. // 1. personUri field has a value: the autocomplete select event has already fired.
if (addAuthorForm.personUriField.val()) { // 2. The last name field is empty (especially since the field has focus when the form is displayed).
// 3. Autocomplete suggestions are showing.
if ( addAuthorForm.personUriField.val() || !$(this).val() || $('ul.ui-autocomplete li.ui-menu-item').length ) {
return; return;
} }
addAuthorForm.onLastNameChange(); addAuthorForm.onLastNameChange();