Dreamweaver personnaliser messages formulaire

Résolu
emarie3680 Messages postés 139 Statut Membre -  
emarie3680 Messages postés 139 Statut Membre -
Bonjour,
J'ai réalisé un formulaire à l'aide de Dreamweaver 4.0.
J'ai établi des comportements pour certains champs qui doivent obligatoirement être remplis.
Cette fonction marche bien mais je trouve que le message d'erreur renvoyé à l'utilisateur n'est pas très clair pour ceux qui ne parlent pas l'anglais.
Par exemple :

The following error(s) occurred:
- Age is required.
- Ville is required.

Ne pourrait-on pas avoir, dans la fenêtre qui s'ouvre :
Les erreurs suivantes se sont produites :
- Le champ Age est obligatoire.
- Le champ ville est obligatoire.

Merci d'avance,

Éric
Configuration: Windows XP
Firefox 3.0.3

4 réponses

  1. 0ReL Messages postés 43 Statut Membre 13
     
    Si on avait le code Html de ta page avec le formulaire devant les yeux ça serai plus facile de répondre...

    ++
    2
  2. chico200987 Messages postés 856 Statut Membre 144
     
    Essai ceci :

    <html>
    <head>
    <title>Questionnaire Assises Jeunesse</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    <!--
    function MM_findObj(n, d) { //v4.0
    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 && document.getElementById) x=document.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+='- '+nm+' doit contenir une adresse email valide.\n';
    } else if (test!='R') {
    if (isNaN(val)) errors+='- '+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 (val<min || max<val) errors+='- '+nm+' doit contenir un nombre entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- Le champs '+nm+' est obligatoire.\n'; }
    } if (errors) alert('Certaines erreurs ont eu lieu:\n'+errors);
    document.MM_returnValue = (errors == '');
    }
    //-->
    </script>
    </head>
    
    <body bgcolor="#FFCC66" text="#000000">
    <p> </p>
    <table width="75%" border="1">
    <tr>
    <td bordercolor="#3333CC" height="47">
    <div align="center"><font size="+2"><b>TU AS LA PAROLE
    !</b></font></div>
    </td>
    </tr>
    </table>
    <form action="Traitement_Quest.php" method="post">
    <p>Tu es :
    <select name="sexe" size="1">
    <option value="Je suis une fille">Une fille</option>
    <option value="Je suis un gars">Un garçon</option>
    </select>
    </p>
    <p>Tu as :
    <input type="text" name="Age" maxlength="2" size="6">
    ans <i>(A remplir obligatoirement)</i></p>
    <p>Tu es :
    <select name="situpro">
    <option value="Je vais au college">Collégien</option>
    <option value="Je vais au lycee">Lycéen</option>
    <option value="Je fais des etudes">Étudiant</option>
    <option value="Je suis en formation">En formation</option>
    <option value="Je suis demandeur emploi">Demandeur d'emploi</option>
    <option value="Je suis salarie">Salarié</option>
    </select>
    </p>
    <p>Autre, préciser :
    <input type="text" name="SituationAutre" size="40">
    </p>
    <p>Dans quelle ville habites-tu ? :
    <input type="text" name="Ville" size="30">
    <i>(A remplir obligatoirement)</i></p>
    <p>Comment te déplaces-tu ? :
    <input type="text" name="deplacement">
    </p>
    <p>Quels sont tes centres d'intérêt ?
    <input type="text" name="centresinteret" size="50">
    </p>
    <p>Merci de nous laisser tes coordonnées :</p>
    <table width="59%" border="0">
    <tr>
    <td width="29%">Nom :</td>
    <td width="24%">
    <input type="text" name="nom" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Prénom :</td>
    <td width="24%">
    <input type="text" name="prenom" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Tél.</td>
    <td width="24%">
    <input type="text" name="tel" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Mail :</td>
    <td width="24%">
    <input type="text" name="mail" size="50">
    </td>
    <td width="47%"><i>(Rentrer une adresse valide)</i></td>
    </tr>
    </table>
    <p>-------------------------------------------------------------------------------------------------------------------------------------------------------</p>
    <p>
    <input type="submit" name="Submit" value="Envoyer" onClick="MM_validateForm('Age','','RisNum','Ville','','R','mail','','NisEmail');return document.MM_returnValue">
    <input type="reset" name="Submit2" value="Rétablir">
    </p>
    </form>
    <p>  </p>
    </body>
    </html>
    
    1
  3. emarie3680 Messages postés 139 Statut Membre 13
     
    OK, je ne voulais pas vous imposer ça ! Tant pis. Il s'agit donc des champs age et ville que j'ai rendus obligatoires. S'ils ne sont pas remplis (en ligne) le message envoyé à l'utilisateur n'est pas clair (voir mon premier message) :

    <html>
    <head>
    <title>Questionnaire Assises Jeunesse</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    <!--
    function MM_findObj(n, d) { //v4.0
    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 && document.getElementById) x=document.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+='- '+nm+' must contain an e-mail address.\n';
    } else if (test!='R') {
    if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
    if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    min=test.substring(8,p); max=test.substring(p+1);
    if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
    }
    //-->
    </script>
    </head>

    <body bgcolor="#FFCC66" text="#000000">
    <p> </p>
    <table width="75%" border="1">
    <tr>
    <td bordercolor="#3333CC" height="47">
    <div align="center"><font size="+2"><b>TU AS LA PAROLE
    !</b></font></div>
    </td>
    </tr>
    </table>
    <form action="Traitement_Quest.php" method="post">
    <p>Tu es :
    <select name="sexe" size="1">
    <option value="Je suis une fille">Une fille</option>
    <option value="Je suis un gars">Un garçon</option>
    </select>
    </p>
    <p>Tu as :
    <input type="text" name="Age" maxlength="2" size="6">
    ans <i>(A remplir obligatoirement)</i></p>
    <p>Tu es :
    <select name="situpro">
    <option value="Je vais au college">Collégien</option>
    <option value="Je vais au lycee">Lycéen</option>
    <option value="Je fais des etudes">Étudiant</option>
    <option value="Je suis en formation">En formation</option>
    <option value="Je suis demandeur emploi">Demandeur d'emploi</option>
    <option value="Je suis salarie">Salarié</option>
    </select>
    </p>
    <p>Autre, préciser :
    <input type="text" name="SituationAutre" size="40">
    </p>
    <p>Dans quelle ville habites-tu ? :
    <input type="text" name="Ville" size="30">
    <i>(A remplir obligatoirement)</i></p>
    <p>Comment te déplaces-tu ? :
    <input type="text" name="deplacement">
    </p>
    <p>Quels sont tes centres d'intérêt ?
    <input type="text" name="centresinteret" size="50">
    </p>
    <p>Merci de nous laisser tes coordonnées :</p>
    <table width="59%" border="0">
    <tr>
    <td width="29%">Nom :</td>
    <td width="24%">
    <input type="text" name="nom" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Prénom :</td>
    <td width="24%">
    <input type="text" name="prenom" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Tél.</td>
    <td width="24%">
    <input type="text" name="tel" size="50">
    </td>
    <td width="47%">  </td>
    </tr>
    <tr>
    <td width="29%">Mail :</td>
    <td width="24%">
    <input type="text" name="mail" size="50">
    </td>
    <td width="47%"><i>(Rentrer une adresse valide)</i></td>
    </tr>
    </table>
    <p>-------------------------------------------------------------------------------------------------------------------------------------------------------</p>
    <p>
    <input type="submit" name="Submit" value="Envoyer" onClick="MM_validateForm('Age','','RisNum','Ville','','R','mail','','NisEmail');return document.MM_returnValue">
    <input type="reset" name="Submit2" value="Rétablir">
    </p>
    </form>
    <p>  </p>
    </body>
    </html>
    0
  4. emarie3680 Messages postés 139 Statut Membre 13
     
    OK, j'essaie !
    0