Index: trunk/extensions/EducationProgram/resources/ep.enlist.js |
— | — | @@ -137,7 +137,8 @@ |
138 | 138 | |
139 | 139 | this.doAdd = function() { |
140 | 140 | var $add = $( '#ep-' + role + '-add-button' ), |
141 | | - $cancel = $( '#ep-' + role + '-add-cancel-button' ); |
| 141 | + $cancel = $( '#ep-' + role + '-add-cancel-button' ), |
| 142 | + isCompletionEnter = false; |
142 | 143 | |
143 | 144 | $add.button( 'option', 'disabled', true ); |
144 | 145 | $add.button( 'option', 'label', ep.msg( 'ep-' + role + '-adding' ) ); |
— | — | @@ -244,6 +245,11 @@ |
245 | 246 | }, |
246 | 247 | close: function() { |
247 | 248 | $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" ); |
| 249 | + }, |
| 250 | + select: function( event, ui ) { |
| 251 | + if ( ( event.keyCode ? event.keyCode : event.which ) === 13 ) { |
| 252 | + isCompletionEnter = true; |
| 253 | + } |
248 | 254 | } |
249 | 255 | } ); |
250 | 256 | } |
— | — | @@ -260,7 +266,13 @@ |
261 | 267 | var enterHandler = function( event ) { |
262 | 268 | if ( event.which == '13' ) { |
263 | 269 | event.preventDefault(); |
264 | | - _this.doAdd(); |
| 270 | + |
| 271 | + if ( isCompletionEnter ) { |
| 272 | + isCompletionEnter = false; |
| 273 | + } |
| 274 | + else { |
| 275 | + _this.doAdd(); |
| 276 | + } |
265 | 277 | } |
266 | 278 | }; |
267 | 279 | |