From 1eb9154b731e9936ae0622188a6e0c382d6b478a Mon Sep 17 00:00:00 2001 From: Garry Collum Date: Thu, 30 Apr 2009 21:54:31 -0400 Subject: [PATCH] Bug #2974 Adding category code to BorrowerMandatoryField produced a "The following fields are mandatory: categorycode" If you made a column that is implemented by a select box mandatory in BorrowerMandatoryField, Members.js would throw an error on the first element. The original intent of the function was probably to catch the first option for a drop-down list such as "Salutation" where the text is blank. Added code to check for an empty string in the first element. You can test this by making salutation (title) mandatory. Also fixed some typos in some of the comments. Why? Because I'm a Librarian. Signed-off-by: Galen Charlton --- koha-tmpl/intranet-tmpl/prog/en/js/members.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/members.js b/koha-tmpl/intranet-tmpl/prog/en/js/members.js index 3798e03ba0..145e95f3f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/members.js @@ -109,10 +109,12 @@ function check_form_borrowers(nav){ var ref_champ=eval("document.form."+champ_verif[i]); //check if it's a select if (ref_champ.type=='select-one'){ - if (ref_champ.options[0].selected ){ + // check to see if first option is selected and is blank + if (ref_champ.options[0].selected && + ref_champ.options[0].text == ''){ // action if field is empty message_champ+=champ_verif[i]+"\n"; - //test to konw if you must show a message with error + //test to know if you must show a message with error statut=1; } } else { @@ -125,7 +127,7 @@ function check_form_borrowers(nav){ } } } - //patrons form to test if you chcked no to the quetsion of double + //patrons form to test if you checked no to the question of double if (statut!=1 && document.form.check_member.value > 0 ) { if (!(document.form_double.answernodouble.checked)){ message =""; -- 2.39.2