#618: Parent/child updates for QCT <select /> --------------------------+--------------------------------- Reporter: olemis | Owner: gjm Type: enhancement | Status: accepted Priority: critical | Milestone: Release 8 Component: ui design | Version: 0.6.0 Resolution: | Keywords: qct, ticket, fields --------------------------+---------------------------------
Comment (by gjm): Something like the following might do the job if we want to include timeouts (2 minutes here): {{{ #!diff Index: bloodhound_theme/bhtheme/htdocs/js/theme.js =================================================================== --- bloodhound_theme/bhtheme/htdocs/js/theme.js (revision 1529833) +++ bloodhound_theme/bhtheme/htdocs/js/theme.js (working copy) @@ -50,6 +50,14 @@ }); */ + function checkSelections () { + return $.inArray('', $('#qct-box select').map(function() {return $(this).val();})) == -1; + } + $('#qct-create').attr("disabled", !checkSelections()); + $('#qct-box select').change(function () { + $('#qct-create').attr("disabled", !checkSelections()); + }); + $('#qct-inline-newticket').click(function() { $('#qct-inline-notice-success, #qct-inline-notice-error').hide(); @@ -100,9 +108,24 @@ } // Clear input controls inside quick create box + var timeout; + $('#qct-newticket').click(function () { + if (timeout) { + clearTimeout(timeout); + } + }); function qct_clearui() { - $('#qct-form input[name!="__FORM_TOKEN"], #qct-form select, #qct- form textarea').val(''); - $('#qct-inline-form input[name!="__FORM_TOKEN"], #qct-inline-form select, #qct-inline-form textarea').val(''); + $('#qct-form input[name!="__FORM_TOKEN"], #qct-form textarea').val(''); + $('#qct-inline-form input[name!="__FORM_TOKEN"], #qct-inline-form textarea').val(''); + $('#qct-create').attr("disabled", !checkSelections()); + if (timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(function () { + $('#qct-form select').val(''); + $('#qct-inline-form select').val(''); + $('#qct-create').attr("disabled", !checkSelections()); + }, 120000); } // We want to submit via #qct-create }}} If the behaviour from this is acceptable that still seems to leave a question of whether we should treat non-cancelling form closure in a different way. -- Ticket URL: <https://issues.apache.org/bloodhound/ticket/618#comment:7> Apache Bloodhound <https://issues.apache.org/bloodhound/> The Apache Bloodhound issue tracker