Binding to 'keydown' was firing before the changed text was available, meaning that we wouldn't run validations until the second character was entered, and causing us to miss pasted text. This change should remedy both issues.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=813924 --- .../views/deployments/launch_time_params.html.haml | 28 ++++++++++---------- 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/app/views/deployments/launch_time_params.html.haml b/src/app/views/deployments/launch_time_params.html.haml index 7fcbe58..3ea2546 100644 --- a/src/app/views/deployments/launch_time_params.html.haml +++ b/src/app/views/deployments/launch_time_params.html.haml @@ -45,6 +45,18 @@ = submit_tag t('.finalize'), :class => 'button primary', :id => 'submit_params'
:javascript + function checkEnteredParams() { + $('.launch-time-params .parameters').each(function() { + var $parameters = $(this).find('.parameter input'); + var filledOut = _.all($parameters, function(item) { + return ! _.isEmpty($(item).val()); + }); + var param_id = $(this).attr('id'); + $('.labels').find('#' + param_id).toggleClass('filled-out', filledOut); + $('#submit_params').attr('disabled', !filledOut); + }); + }; + (function () { function selectService($service) { var old_param_id = $('.service.selected').attr('id'); @@ -60,25 +72,13 @@ .text($service.next('.description').text()); }
- function checkEnteredParams() { - $('.launch-time-params .parameters').each(function() { - var $parameters = $(this).find('.parameter input'); - var filledOut = _.all($parameters, function(item) { - return ! _.isEmpty($(item).val()); - }); - var param_id = $(this).attr('id'); - $('.labels').find('#' + param_id).toggleClass('filled-out', filledOut); - $('#submit_params').attr('disabled', !filledOut); - }); - } - var $services = $('.launch-time-params .services .labels h4.service'); selectService($services.first()); $services.live('click', function(e) { selectService($(this)); });
$('#submit_params').attr('disabled', true); - $('.parameter input').live('keydown', function(e) { - checkEnteredParams(); + $('.parameter input').live('keyup mouseup paste', function(e) { + setTimeout("checkEnteredParams()", 10) }); checkEnteredParams(); })();