diff --git a/umap/static/umap/js/umap.tableeditor.js b/umap/static/umap/js/umap.tableeditor.js index 11896d5e..66aca2a5 100644 --- a/umap/static/umap/js/umap.tableeditor.js +++ b/umap/static/umap/js/umap.tableeditor.js @@ -34,7 +34,7 @@ L.U.TableEditor = L.Class.extend({ }; var doRename = function () { var newName = prompt(L._('Please enter the new name of this property'), property); - if (!newName) return; + if (!newName || !this.validateName(newName)) return; this.datalayer.eachLayer(function (feature) { feature.renameProperty(property, newName); }); @@ -73,6 +73,14 @@ L.U.TableEditor = L.Class.extend({ this.properties = this.datalayer._propertiesIndex; }, + validateName: function (name) { + if (name.indexOf(".") !== -1) { + this.datalayer.map.ui.alert({content: L._('Invalide property name: {name}', {name: name}), level: 'error'}); + return false; + } + return true; + }, + edit: function () { var id = 'tableeditor:edit'; this.datalayer.map.fire('dataloading', {id: id}); @@ -86,7 +94,7 @@ L.U.TableEditor = L.Class.extend({ label.textContent = label.title = L._('Add a new property'); var addProperty = function () { var newName = prompt(L._('Please enter the name of the property')); - if (!newName) return; + if (!newName || !this.validateName(newName)) return; this.datalayer.indexProperty(newName); this.edit(); };