From 587189e3025a8d6cfeb0a701b9eb1d3300241a52 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Mon, 30 Jul 2012 14:29:47 -0700 Subject: [PATCH] CS-15726: Use custom validation for tagger widget Show a generic dialog box for tagger validation, instead of using jQuery validate --it conflicted with the detail view's edit fields and prevented submission unless the key and value fields were filled out. --- ui/scripts/ui/widgets/tagger.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ui/scripts/ui/widgets/tagger.js b/ui/scripts/ui/widgets/tagger.js index f671342c99c..c6169454cb2 100644 --- a/ui/scripts/ui/widgets/tagger.js +++ b/ui/scripts/ui/widgets/tagger.js @@ -1,13 +1,26 @@ (function($, cloudStack) { + var isFormValid = function($form) { + var key = $form.find('input[name=key]').val(); + var value = $form.find('input[name=value]').val(); + + if (!key || !value) { + cloudStack.dialog.notice({ message: 'Please specify a tag key and value' }); + + return false; + } + + return true; + }; + var elems = { inputArea: function(args) { var $form = $('
').addClass('tag-input'); var $keyField = $('
').addClass('field key'); var $keyLabel = $('