Bonjour tout le monde,

voila mon problème. J''utilise la fonction writeRichText pour creer une textarea, 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 <tr><td><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="bleu">
		  <tr>
            <td width="15%" valign="top"><img src="../icons/arrow.gif" width="10" height="9" align="absmiddle"> Question <span class="rouge"> *</span> : </td>
            <td colspan="3"><?php
if ($GLOBALS['wysiwygMac_'.$nomModule]) {               
function rteSafe($strText) {
        //returns safe code for preloading in the RTE
        $tmpString = $strText;
        
        //convert all types of single quotes
        $tmpString = str_replace(chr(145), chr(39), $tmpString);
        $tmpString = str_replace(chr(146), chr(39), $tmpString);
        $tmpString = str_replace("'", "'", $tmpString);
        
        //convert all types of double quotes
        $tmpString = str_replace(chr(147), chr(34), $tmpString);
        $tmpString = str_replace(chr(148), chr(34), $tmpString);
//      $tmpString = str_replace("\"", "\"", $tmpString);
        
        //replace carriage returns & line feeds
        $tmpString = str_replace(chr(10), " ", $tmpString);
        $tmpString = str_replace(chr(13), " ", $tmpString);
        
        return $tmpString;
}
?>
<script language="JavaScript" type="text/javascript">
<!--
function submitForm() {
	//make sure hidden and iframe values are in sync before submitting form
	//to sync only 1 rte, use updateRTE(rte)
	//to sync all rtes, use updateRTEs
	updateRTE('actu');
	//updateRTEs();
 
	//change the following line to true to submit form
	return true;
}
 
//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
initRTE("../wysiwyg_2/images/", "../wysiwyg_2/", "", true);
//-->
</script>
<noscript><p><b>Javascript doit être actif pour utiliser cette page.</b></p></noscript>
 
<script language="JavaScript" type="text/javascript">
<!--
<?php
//format content for preloading
if (!$modification) {
	$content = "";
	$content = rteSafe($content);
} else {
	//retrieve posted value
//	$content = rteSafe(stripslashes($tab_detail['descr']));
}
?>//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('actu', '', 450, 100, true, false);
//-->
</script>
<?
} // fin if $GLOBALS['wysiwygMac_'.$nomModule]
else {
?>
 
	<!-- Wysiwyg IE -->
	<textarea name="actu" cols="62" rows="20" id="Description" alt='needed'></textarea>
	<script language="JavaScript1.2">
		editor_generate('actu','','');
	</script>
<? } // fin else $GLOBALS['wysiwygMac_'.$nomModule] ?>
</td>
 
          </tr>
          </table></td></tr>
Afin de vérifier que quelque chose ait bien été entré dans la textarea, je fais un control lors de la validation du formulaire :

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
          <script language="javascript">
 
   function Check(formulaire) { // Fonction appel&eacute;e par le bouton
	  var errmsg = "Erreur : \n";
/*	  <? // if ($GLOBALS['wysiwygMac_'.$nomModule]) { ?>
	  if (frames['actu'].document.body.innerHTML.length == 0) {
	  	errmsg=errmsg+"-Votre Description est obligatoire. \n"; 
	  }
	  <? // } ?>*/	  
	  for(i=0;i<formulaire.elements.length;i++)
	  {
	  	//alert(formulaire.elements[i].id + " :: " + formulaire.elements[i].value);
		  if ((formulaire.elements[i].alt == "needed" || formulaire.elements[i].name == 'type' || formulaire.elements[i].name == 'langue' || formulaire.elements[i].name == 'actu') && (formulaire.elements[i].value == "Completez ici" || formulaire.elements[i].value == "" ))  
		  { 
			 errmsg=errmsg+"-Votre "+formulaire.elements[i].id+" est obligatoire. \n"; 
		  }
	  }
	  alert(formulaire.actu.value);
	  if(formulaire.rubrique.value == "aucune"){
	  	errmsg = errmsg+"-Votre rubrique est obligatoire. \n";
	  }
	  if(document.getElementById("sousrubrique").value == 0){
	  	errmsg = errmsg + "-Votre sous rubrique est obligatoire. \n";
	  }
	  if(formulaire.produitAssocie.value == "0"){
	  	errmsg = errmsg + "-Votre produit à associer est obligatoire. \n"
	  }
 
	  if(errmsg != "Erreur : \n")
	  {
		 alert(errmsg); 
		 return false;
	  }
	 return true;  
   }
        </script>
Le problème est que j'ai nommé ma textarea 'actu', et que a chaque fois que je valide mon formulaire, j'ai l'erreur suivante dans ma popup :

'-Votre hdnactu est obligatoire'

Je ne vois vraiment pas d'ou vient cette hdnactu :s.

De plus, lorsque j'enlève ce controle et que je poste mon formulaire, ma variable $_post ne me retourne rien, même quand je remplis le champ.

Si quelqu'un voir mon erreur :s. Merci d'avance