@@ -, +, @@ preferences --- .../prog/en/modules/admin/preferences.tt | 1 + .../intranet-tmpl/prog/js/pages/preferences.js | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -202,6 +202,7 @@ var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" ); var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" ); var MSG_LOADING = _( "Loading..." ); + var MSG_INVALID = _( "Error: presence of invalid data prevent saving. Please make the corrections and try again." ); [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] [% Asset.js("js/ajax.js") | $raw %] --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -2,6 +2,11 @@ KOHA.Preferences = { Save: function ( form ) { + if ( ! $(form).valid() ) { + humanMsg.displayAlert( MSG_INVALID ); + return; + } + modified_prefs = $( form ).find( '.modified' ); // $.serialize removes empty value, we need to keep them. // If a multiple select has all its entries unselected @@ -143,4 +148,24 @@ $( document ).ready( function () { if ( search_jumped ) { document.location.hash = "jumped"; } + + $(".prefs-tab form").each(function () { + $(this).validate({ + rules: { }, + errorPlacement: function(error, element) { + var placement = $(element).parent(); + if (placement) { + $(placement).append(error) + } else { + error.insertAfter(element); + } + } + }); + }); + + $(".preference-email").each(function() { + $(this).rules("add", { + email: true + }); + }); } ); --