diff options
author | Ryan Campbell <ryanjcampbell@google.com> | 2017-09-27 11:25:25 -0700 |
---|---|---|
committer | Ryan Campbell <ryanjcampbell@google.com> | 2017-09-27 11:25:25 -0700 |
commit | 4f8d7b9a8e50fcc2c1a459e4ebfaee3978e4dd85 (patch) | |
tree | ac9a1abbddc22590901aa4163d8996a932a01cb5 /src | |
parent | edd65f5563afb0affcc95d3c51fc19c9c49c7171 (diff) | |
download | dashboard-4f8d7b9a8e50fcc2c1a459e4ebfaee3978e4dd85.tar.gz |
Prevent user from submitting an incomplete form.
When the user didn't finish adding a test acknowledgment, refocus on the
first incomplete field instead of saving.
Test: staging
Bug: 67001652
Change-Id: I889f32cd53838e109f222aaed10e91d7d7c60e96
Diffstat (limited to 'src')
-rw-r--r-- | src/main/webapp/js/test_acknowledgments.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/webapp/js/test_acknowledgments.js b/src/main/webapp/js/test_acknowledgments.js index 8c5d837..da47870 100644 --- a/src/main/webapp/js/test_acknowledgments.js +++ b/src/main/webapp/js/test_acknowledgments.js @@ -151,6 +151,18 @@ * @param note (String) The note in the acknowledgment. */ function saveCallback(ack, modal, key, test, branchSet, deviceSet, testCaseSet, note) { + var allEmpty = true; + var firstUnemptyInput = null; + var vals = modal.find('.modal-section>.input-container>input').each(function(_, input) { + if (!!$(input).val()) { + allEmpty = false; + if (!firstUnemptyInput) firstUnemptyInput = $(input); + } + }); + if (!allEmpty) { + firstUnemptyInput.focus(); + return false; + } var branches = Array.from(branchSet); branches.sort(); var devices = Array.from(deviceSet); |