1 <script language="JavaScript" type="text/javascript">
5 * This function is used just for localisation
7 function _(s) { return s; }
9 function CheckDate(field) {
12 // this function checks id date is like JJ/MM/AAAA
13 var amin = 1900; // année mini
14 var amax = 2100; // année maxi
16 var date = d.split("/");
21 if ( (date.length < 2) && (ok==1) ) {
22 msg = _("Separator must be /");
23 alert(msg); ok=0; field.focus();
32 if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) {
33 msg = _("day not correct.");
34 alert(msg); ok=0; field.focus();
39 if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) {
40 msg = _("month not correct.");
41 alert(msg); ok=0; field.focus();
46 if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) {
47 msg = _("years not correct.");
48 alert(msg); ok=0; field.focus();
54 //function test if member is unique and if it's right the member is registred
58 if ( document.form.check_member.value==1){
59 if (document.form.categorycode.value != "I"){
61 msg1 += ("Warning !!!! Duplicate borrower!!!!");
63 check_form_borrowers(0);
64 document.form.submit();
67 msg2 += ("Warning !!!! Duplicate organisation!!!!");
69 check_form_borrowers(0);
74 document.form.submit();
79 //function test if date enrooled < date expiry
80 function check_manip_date(status) {
81 if (status=='verify'){
82 // this part of function('verify') is used to check if dateenrolled<date expiry
83 if (document.form.dateenrolled != '' && document.form.dateexpiry.value !='') {
84 var myDate1=document.form.dateenrolled.value.split ('/');
85 var myDate2=document.form.dateexpiry.value.split ('/');
86 if ((myDate1[2]>myDate2[2])||(myDate1[2]==myDate2[2] && myDate1[1]>myDate2[1])||(myDate1[2]==myDate2[2] && myDate1[1]>=myDate2[1] && myDate1[0]>=myDate2[0]))
89 document.form.dateenrolled.focus();
90 var msg = ("Warning !!! check date expiry >= date enrolment");
99 // function to test all fields in forms and nav in different forms(1 ,2 or 3)
100 function check_form_borrowers(nav){
102 if (nav < document.form.step.value) {
103 document.form.step.value=nav;
104 if ((document.form.step.value==0) && document.form.check_member.value == 1 )
107 if (document.form_double.answernodouble) {
108 if( (!(document.form_double.answernodouble.checked))){
109 document.form.nodouble.value=0;
112 document.form.nodouble.value=1;
116 document.form.submit();
119 if (document.form.BorrowerMandatoryField.value==''||document.form.FormFieldList.value=='' )
123 var champ_verif = document.form.BorrowerMandatoryField.value.split ('|');
124 var champ_form= document.form.FormFieldList.value.split('|');
125 var message ="The following fields are mandatory :\n";
126 var message_champ="";
127 for (var j=0; j<champ_form.length; j++){
128 if (document.getElementsByName(""+champ_form[j]+"")[0]){
129 for (var i=0; i<champ_verif.length; i++) {
130 if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
131 var val_champ=eval("document.form."+champ_verif[i]+".value");
132 var ref_champ=eval("document.form."+champ_verif[i]);
133 var val_form=eval("document.form."+champ_form[j]+".value");
134 if (champ_verif[i] == champ_form[j]){
135 //check if it's a select
136 if (ref_champ.type=='select-one'){
137 if (ref_champ.options[0].selected ){
138 // action if field is empty
139 message_champ+=champ_verif[i]+"\n";
140 //test to konw if you must show a message with error
144 if ( val_champ == '' ) {
145 // action if the field is not empty
146 message_champ+=champ_verif[i]+"\n";
156 //borrowers form 2 test if u chcked no to the quetsion of double
157 if (document.form.step.value==2 && statut!=1 && document.form.check_member.value > 0 )
161 if (!(document.form_double.answernodouble.checked)){
164 message_champ+=("Please confirm suspicious duplicate borrower !!! ");
166 document.form.nodouble.value=0;
169 document.form.nodouble.value=1;
174 //alert if at least 1 error
175 alert(message+"\n"+message_champ);
179 document.form.step=nav;
180 document.form.submit();
185 function Dopop(link) {
186 // // var searchstring=document.form.value[i].value;
187 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top');
190 function Dopopguarantor(link) {
192 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');