diff options
Diffstat (limited to 'src/fauxton')
-rw-r--r-- | src/fauxton/app/addons/documents/views.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index bba23af32..cc23e195e 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -1142,17 +1142,26 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }, validateKeys: function(param){ - var parsedValue = this.parseJSON(param.value); - if (_.isUndefined(parsedValue) || !_.isArray(parsedValue)) { + var errorMsg = false, + parsedValue = this.parseJSON(param.value); + + if (_.isUndefined(parsedValue)) { + errorMsg = "Keys must be valid json."; + } else if (!_.isArray(parsedValue)) { + errorMsg = "Keys values must be in an array. E.g [1,2,3]"; + } + + if (errorMsg) { this.$('.js-keys-error').empty(); FauxtonAPI.addNotification({ type: "error", - msg: "Keys values must be in an array. E.g [1,2,3]", + msg: errorMsg, clear: false, selector: '.js-keys-error' }); return false; } + return true; }, queryParams: function () { |