text varchar null if empty

This commit is contained in:
yuri
2018-10-17 14:50:47 +03:00
parent e2e99009a3
commit ada764bb7f
4 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -593,7 +593,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
validateRequired: function () {
if (this.isRequired()) {
if (this.model.get(this.name) === '') {
if (this.model.get(this.name) === '' || this.model.get(this.name) === null) {
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.getLabelText());
this.showValidationMessage(msg);
return true;
+6
View File
@@ -191,6 +191,12 @@ Espo.define('views/fields/text', 'views/fields/base', function (Dep) {
}
},
fetch: function () {
var data = {};
data[this.name] = this.$element.val() || null;
return data;
},
fetchSearch: function () {
var type = this.$el.find('[name="'+this.name+'-type"]').val() || 'startsWith';
+1 -1
View File
@@ -86,7 +86,7 @@ Espo.define('views/fields/url', 'views/fields/varchar', function (Dep) {
fetch: function () {
var data = Dep.prototype.fetch.call(this);
if (this.params.strip) {
if (this.params.strip && data[this.name]) {
data[this.name] = this.strip(data[this.name]);
}
return data;
+1 -1
View File
@@ -159,7 +159,7 @@ Espo.define('views/fields/varchar', 'views/fields/base', function (Dep) {
value = value.trim();
}
}
data[this.name] = value;
data[this.name] = value || null;
return data;
},