|
|
|
|
Bonjour,
J'essaie vainement de trouver une solution pour pouvoir afficher ce que donnera réellement l'envoi d'un formulaire, puis retourner à ce formulaire soit pour corriger, soit pour envoyer.
Mon code fonctionne parfaitement avec Firefox, mais pas avec Internet Explorer.
Sur ce dernier, lors du retour, la liste de choix est désactivée. Y a-t-il une solution simple?
Voici un exemple simplifié illustrant ce que je veux faire (ne traitant pas de l'envoi des données puisque le problème ne se situe pas à ce niveau)
<html>
<head>
<title>Document sans-titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function SelectionAutrePays()
{
var Indice = document.forms['Annonce'].elements['Z_PAYS'].selectedIndex;
var Valeur = document.forms['Annonce'].elements['Z_PAYS'].options[Indice].text;
document.forms['Annonce'].elements['Z_AUTRE_PAYS'].style.visibility = (Valeur=="Autre pays")?"visible":"hidden";
document.forms['Annonce'].elements['Z_AUTRE_PAYS'].disabled = (Valeur=="Autre pays")?false:true;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="Annonce" action="1_Essai.php" method="post">
<?php
if (isset($_POST['B_ENVOI']))
{
if ($_POST['RADIO_SELECTION']=="Poster")
{
if (isset($_POST['Z_AUTRE_PAYS']))
{
echo "Pays choisi: ".$_POST['Z_AUTRE_PAYS'];
}
else
{
echo "Pays choisi: ".$_POST['Z_PAYS'];
}
}
elseif ($_POST['RADIO_SELECTION']=="Voir")
{
?>
<!-- Début partie visualisation **************************************************** -->
<table width="500" border="1" cellspacing="0" align="center">
<tr bgcolor="#008000">
<td colspan="2">
<div align="center"><b><font color="#FFFFFF">Exemple</font></b></div>
</td>
</tr>
<tr>
<td width="179"><b>Pays choisi:</b></td>
<td width="311">
<div align="center"><?php if(isset($_POST['Z_AUTRE_PAYS'])){echo $_POST['Z_AUTRE_PAYS'];}else{echo $_POST['Z_PAYS'];}?></div>
</td>
</tr>
<tr>
<td width="490" colspan="2" height="2">
<div align="center">
<input type="button" name="B_RETOUR" value="Retour" onclick="history.back()">
</div>
</td>
</tr>
</table>
<!-- Fin partie visualisation ***************************************************** -->
<?php
}
}
else
{
?>
<!-- Début partie affichage formulaire******************************************** -->
<p align="center">
<select name="Z_PAYS" size="1" onchange="SelectionAutrePays();">
<option>Belgique</option>
<option>France</option>
<option>Autre pays</option>
</select>
<input type="text" name="Z_AUTRE_PAYS" <?php if (!isset($_POST['Z_PAYS']) OR $_POST['Z_PAYS']!="Autre pays"){echo " disabled style=\"visibility:hidden;\"";}?>>
</p>
<p align="center">Que voulez-vous faire?
<input type="radio" name="RADIO_SELECTION" value="Voir" checked>
Visualiser
<input type="radio" name="RADIO_SELECTION" value="Poster">
Poster</p>
<p align="center">
<input type="submit" name="B_ENVOI" value="Envoyer">
</p>
<!-- Fin partie affichage formulaire*********************************************** -->
<?php
}
?>
</form>
</body>
</html>
Configuration: Windows XP Firefox 3.0.7
Salut,
|