added event listener to input to prevent spaces

This commit is contained in:
bill bittner 2017-07-22 16:21:37 -07:00
parent e99e8291bd
commit afae6a79c3
2 changed files with 7 additions and 2 deletions

View file

@ -120,8 +120,7 @@ function previewAndStageFile(selectedFile){
// set the name input value to the image name if none is set yet
if (nameInput.value === "") {
var filename = selectedFile.name.substring(0, selectedFile.name.indexOf('.'))
filename = filename.replace(/\s+/g, '-');
nameInput.value = filename;
nameInput.value = filename.replace(/\s+/g, '-');;
}
// store the selected file for upload
stagedFiles = [selectedFile];

View file

@ -58,4 +58,10 @@
document.getElementById('publish-active-area').innerHTML = publishResults;
window.location.href = showUrl;
});
//event listener to filter claim name inputs
document.getElementById('publish-name').addEventListener('input', function() {
var name = this.value;
this.value = name.replace(/\s+/g, '-');
})
</script>