diff --git a/apps/documenteditor/main/app/view/ControlSettingsDialog.js b/apps/documenteditor/main/app/view/ControlSettingsDialog.js index 0920897c2..3d9e3a31e 100644 --- a/apps/documenteditor/main/app/view/ControlSettingsDialog.js +++ b/apps/documenteditor/main/app/view/ControlSettingsDialog.js @@ -502,6 +502,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', onAddItem: function() { var me = this, win = new DE.Views.EditListItemDialog({ + store: me.list.store, handler: function(result, name, value) { if (result == 'ok') { var rec = me.list.store.add({ @@ -524,6 +525,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', var me = this, rec = this.list.getSelectedRec(), win = new DE.Views.EditListItemDialog({ + store: me.list.store, handler: function(result, name, value) { if (result == 'ok') { if (rec) { diff --git a/apps/documenteditor/main/app/view/EditListItemDialog.js b/apps/documenteditor/main/app/view/EditListItemDialog.js index ba854af97..56b05eca2 100644 --- a/apps/documenteditor/main/app/view/EditListItemDialog.js +++ b/apps/documenteditor/main/app/view/EditListItemDialog.js @@ -60,7 +60,7 @@ define([ '
', '', '
', - '
', + '
', '
', '', '
', @@ -99,7 +99,15 @@ define([ me.inputValue = new Common.UI.InputField({ el : $('#id-dlg-label-value'), style : 'width: 100%;', - validateOnBlur: false + validateOnBlur: false, + validation : function(value) { + if (value!=='' && me.options.store) { + var rec = me.options.store.findWhere({value: value}); + if (rec) + return me.textValueError + } + return true; + } }); me.inputValue._input.on('input', function (e) { if (me.copyvalue==undefined && me.inputValue.getValue()==me.inputName.getValue()) { @@ -140,6 +148,10 @@ define([ this.inputName.cmpEl.find('input').focus(); return; } + if (this.inputValue.checkValidate() !== true) { + this.inputValue.cmpEl.find('input').focus(); + return; + } } this.options.handler.call(this, state, this.inputName.getValue(), this.inputValue.getValue()); @@ -157,6 +169,7 @@ define([ textDisplayName: 'Display name', textValue: 'Value', - textNameError: 'Display name must not be empty.' + textNameError: 'Display name must not be empty.', + textValueError: 'An item with the same value already exists.' }, DE.Views.EditListItemDialog || {})); }); \ No newline at end of file