@@ -, +, @@ allow lists that start or end with whitespace --- C4/VirtualShelves/Page.pm | 3 ++- .../prog/en/modules/virtualshelves/shelves.tt | 9 +++++---- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 13 ++++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) --- a/C4/VirtualShelves/Page.pm +++ a/C4/VirtualShelves/Page.pm @@ -258,7 +258,8 @@ sub shelfpage ($$$$$) { } if ( $query->param('shelves') ) { my $stay = 1; - if ( my $newshelf = $query->param('addshelf') ) { + my $newshelf = $query->param('addshelf'); + if ($newshelf =~ /^\S.*\S$/ || $newshelf =~ /^\S$/) { # note: a user can always add a new shelf my $shelfnumber = AddShelf( $newshelf, $query->param('owner'), $query->param('category'), $query->param('sortfield') ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -94,12 +94,13 @@ function placeHold () { function Check(f) { var _alertString=""; var alertString2; + var addshelf = $("#addshelf").val(); - if($("#addshelf").val() == "0"){ - alert("The number 0 is not a valid name for a list, please enter another name."); + if ( !(/^\S.*\S$/.test(addshelf)) && !( /^\S$/.test(addshelf)) ) { + _alertString += _("The List Name is not valid."); } - if($("#addshelf").val() == ""){ + if (addshelf == ""){ _alertString += _("- You must enter a List Name") + "\n"; } @@ -133,7 +134,7 @@ function placeHold () { [% FOREACH paramsloo IN paramsloop %]