diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index ccf3217..ef18358 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -634,6 +634,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { 'SQL_TAB': '{{ _('SQL') }}', 'SQL_NO_CHANGE': '\n -- ' + '{{ _('Nothing changed') }}', 'MUST_BE_INT' : " {{ _("'%%s' must be an integer.") }}", + 'MUST_BE_NUM' : " {{ _("'%%s' must be a numeric.") }}", 'MUST_GR_EQ' : " {{ _("'%%s' must be greater than or equals to %%d.") }}", 'MUST_LESS_EQ' : " {{ _("'%%s' must be less than or equals to %%d.") }}" } diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index 8ffaecb..84f1c04 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -67,7 +67,7 @@ var controlMapper = Backform.controlMapper = { 'int': ['uneditable-input', 'integer', 'integer'], 'text': ['uneditable-input', 'input', 'string'], - 'numeric': ['uneditable-input', 'input', 'number'], + 'numeric': ['uneditable-input', 'numeric', 'numeric'], 'date': 'datepicker', 'boolean': 'boolean', 'options': ['readonly-option', 'select', Backgrid.Extension.PGSelectCell], @@ -1252,6 +1252,109 @@ this.stopListening(this.model, "change:" + name, this.render); this.model.set(name, value); this.listenTo(this.model, "change:" + name, this.render); + } else { + if (this.model.collection || this.model.handler) { + (this.model.collection || this.model.handler).trigger( + 'pgadmin-session:model:invalid', this.model.errorModel.get(name), this.model + ); + } else { + (this.model).trigger( + 'pgadmin-session:invalid', this.model.errorModel.get(name), this.model + ); + } + } + } + }); + + /* + * Numeric input Control functionality just like backgrid + */ + var NumericControl = Backform.NumericControl = Backform.InputControl.extend({ + defaults: { + type: "number", + label: "", + min: undefined, + max: undefined, + maxlength: 255, + extraClasses: [], + helpMessage: null + }, + template: _.template([ + '', + '