Bug 18980: Remove js function Check from opac-shelves
This function only serves to check if the shelf name is not empty. It
does not even work since it incorrectly refers to f.addshelf (while it
should test #shelfname).
We can solve this and improve consistency by doing the same as in the
staff template with html5 required.
Test plan:
[1] Without this patch it was possible to add a list without a name in
OPAC (with js error: TypeError: f.addshelf is undefined).
[2] With this patch, verify that you cannot do this anymore.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
93366e10fb
commit
efc4caec96
|
|
@ -549,7 +549,7 @@
|
|||
<ol>
|
||||
<li>
|
||||
<label class="required" for="shelfname">List name: </label>
|
||||
<input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname |html %]" /></li>
|
||||
<input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname |html %]" required="required" class="required"/> <span class="required">Required</span></li>
|
||||
<li>
|
||||
<label for="sortfield" >Sort this list by: </label>
|
||||
<select name="sortfield" id="sortfield">
|
||||
|
|
@ -603,7 +603,7 @@
|
|||
</fieldset>
|
||||
|
||||
<fieldset class="action">
|
||||
<input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
|
||||
<input type="submit" value="Save" class="btn" />
|
||||
[% IF referer == 'view' %]
|
||||
<a href="/cgi-bin/koha/opac-shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber %]" class="cancel">Cancel</a>
|
||||
[% ELSE %]
|
||||
|
|
@ -938,24 +938,6 @@ $(function() {
|
|||
AdjustRemark();
|
||||
}); // document.ready
|
||||
|
||||
function Check(f) {
|
||||
var _alertString="";
|
||||
var alertString2;
|
||||
|
||||
if(f.addshelf.value.length ==0){
|
||||
_alertString += _("- You must enter a list name") + "\n";
|
||||
}
|
||||
|
||||
if (_alertString.length==0) {
|
||||
f.submit();
|
||||
} else {
|
||||
alertString2 = _("Form not submitted because of the following problem(s)");
|
||||
alertString2 += "\n------------------------------------------------------------------------------------\n\n";
|
||||
alertString2 += _alertString;
|
||||
alert(alertString2);
|
||||
}
|
||||
}
|
||||
|
||||
function AdjustRemark() {
|
||||
var category;
|
||||
if( $("#category").length > 0 ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue