Allowing only alphanumerical characters, dash and underscore when autogenerating a folder name

This commit is contained in:
Djamil Legato
2014-09-26 10:55:00 -07:00
parent f1b59ed5f5
commit 5774c6209f

View File

@@ -27,7 +27,7 @@ $(function(){
})
$('input[name="title"]').on('input', function(e){
if (!$('input[name="folder"]').data('user-custom-folder')) {
folder = $(this).val().toLowerCase().replace(/\s/g, '-');
folder = $(this).val().toLowerCase().replace(/\s/g, '-').replace(/[^a-z0-9_\-]/g, '');
$('input[name="folder"]').val(folder);
}
});