Bonjour tout le monde.

Pour ceux qui connaisse cette fonction qui peut me dire pourquoi elle ne fonctionne pas avec mon textarea j'ai beau renseigner le champ la fonction considère que mon champ est vide. Soit j'ai fait une erreur de frappe que je vois pas parce que je suis miro soit il y a un problème.

Voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+=
'-le champ '+nm+' doit contenir une adresse mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='-le champ '+nm+' doit contenir un nombre.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' doit contenir une nombre entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '-le champ '+nm+' doit être renseigné.\n'; }
  } if (errors) alert('Erreur(s) à rectifier:\n'+errors);
  document.MM_returnValue = (errors == '');
}
 
...
 
<td>
  <td align="right" valign="top" nowrap="nowrap"><strong>Description
<span class="Style4">*</span></strong></td>
              <td><textarea name="description" cols="32" rows="15" 
id="description"></textarea></td>
...
<input type="submit" onclick="MM_validateForm('nomProduit','','R','reference','','R',
'description','','R','prix','','RisNum','petiteImage','','R','grandeImage','','R');
return document.MM_returnValue" value="Ins&eacute;rer l'enregistrement" /></td>
Merci.