Updated Branches: refs/heads/master f16b5103d -> 2c6bc0e91
CS-16197: cloudstack UI - Tags - input validation. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2c6bc0e9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2c6bc0e9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2c6bc0e9 Branch: refs/heads/master Commit: 2c6bc0e9185f6226ea757cbec01b4c9fae8adbbe Parents: f16b510 Author: Jessica Wang <[email protected]> Authored: Mon Oct 1 16:05:19 2012 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon Oct 1 16:07:45 2012 -0700 ---------------------------------------------------------------------- ui/scripts/ui/widgets/tagger.js | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c6bc0e9/ui/scripts/ui/widgets/tagger.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/tagger.js b/ui/scripts/ui/widgets/tagger.js index f996f33..0f297eb 100644 --- a/ui/scripts/ui/widgets/tagger.js +++ b/ui/scripts/ui/widgets/tagger.js @@ -21,11 +21,13 @@ var value = $form.find('input[name=value]').val(); if (!key || !value) { - cloudStack.dialog.notice({ message: 'Please specify a tag key and value' }); - + cloudStack.dialog.notice({ message: 'Please specify a tag key and value' }); return false; } - + + if($form.find('div.field.key').find('label.error').css('display') == 'block' || $form.find('div.field.value').find('label.error').css('display') == 'block') + return false; + return true; }; @@ -34,10 +36,10 @@ var $form = $('<form>').addClass('tag-input'); var $keyField = $('<div>').addClass('field key'); var $keyLabel = $('<label>').attr('for', 'key').html(_l('label.key') + ':'); - var $key = $('<input>').addClass('key').attr('name', 'key'); + var $key = $('<input>').addClass('key disallowSpecialCharacters').attr('name', 'key'); var $valueField = $('<div>').addClass('field value'); var $valueLabel = $('<label>').attr('for', 'value').html(_l('label.value') + ':'); - var $value = $('<input>').addClass('value').attr('name', 'value'); + var $value = $('<input>').addClass('value disallowSpecialCharacters').attr('name', 'value'); var $submit = $('<input>').attr('type', 'submit').val('Add'); $keyField.append($keyLabel, $key); @@ -47,7 +49,7 @@ $submit ); - $form.validate({ onfocusout: false }); + $form.validate(); $form.submit( args.onSubmit ?
