- var message ="The following fields are mandatory :\n";
- var message_champ="";
- for (var i=0; i<champ_verif.length; i++) {
- if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
- var val_champ=eval("document.form."+champ_verif[i]+".value");
- 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 ){
- // action if field is empty
- message_champ+=champ_verif[i]+"\n";
- //test to konw if you must show a message with error
- statut=1;
- }
- }else {
- if ( val_champ == '' ) {
- // action if the field is not empty
- message_champ+=champ_verif[i]+"\n";
- statut=1;
- }
- }
- }
- }
+ message += MSG_MISSING_MANDATORY
+ message += "\n";
+ for (var i=0; i<champ_verif.length; i++) {
+ if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
+ var val_champ=eval("document.form."+champ_verif[i]+".value");
+ var ref_champ=eval("document.form."+champ_verif[i]);
+ //check if it's a select
+ if (ref_champ.type=='select-one'){
+ // 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 know if you must show a message with error
+ statut=1;
+ }
+ } else {
+ if ( val_champ == '' ) {
+ // action if the field is not empty
+ message_champ+=champ_verif[i]+"\n";
+ statut=1;
+ }
+ }
+ }
+ }