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 <galen.charlton@liblime.com>
Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
This commit is contained in:
Garry Collum 2009-04-30 21:54:31 -04:00 committed by Henri-Damien LAURENT
parent d189c46df5
commit 6f7b4fc8a7
1 changed files with 5 additions and 3 deletions

View File

@ -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 ="";