Formulaire

grimpator Messages postés 4 Date d'inscription mercredi 22 avril 2009 Statut Membre Dernière intervention 23 avril 2009 - 22 avril 2009 à 15:01
grimpator Messages postés 4 Date d'inscription mercredi 22 avril 2009 Statut Membre Dernière intervention 23 avril 2009 - 23 avril 2009 à 08:41
onjour,

mon pb est le suivant:

-j'ai crée un menu déroulant contenant les champs SA SAS SARL URL SCP SCI ...

-j'ai ensuite crée un autre menu déroulant contenant les champs: PRIVE PUBLIC

-Je voudrais maintenant faire en sorte que si le choix s'est porté sur
une SA ou une SARL il 'y ait une impossibilité de choisir la nature
"public"; Voici mon script:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >

<head>

<title>Fiche_Physique</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link rel="stylesheet" media="screen" type="text/css" title="Design" href="autres.css" />

<script type="text/javascript" src="test.js" ></script>

</head>



<form method="post" action="cible_autres.php" >




TITRE




<select name="titre">


<option value="SA">SA</option>

<option value="SAS">SAS</option>

<option value="SARL">SARL</option>

<option value="URL">URL</option>

<option value="SCP">SCP</option>

<option value="SCI">SCI</option>


</select>





<select name="Nat_ju">


<option value="PRIVE">PRIVE</option>

<option value="PUBLIC">PUBLIC</option>


</select>



</form>



</html>


sur un fichier test.js , j'ai écrit cela:

if(name=="titre")

{

if (option value=="SA")

{


<select name="Nat_ju">


<option value="PRIVE">PRIVE</option>


</select>

}

else

{

<select name="Nat_ju">


<option value="PRIVE">PRIVE</option>

<option value="PUBLIC">PUBLIC</option>


</select>


}


}


merci pour vos réponses

2 réponses

Orange73 Messages postés 1375 Date d'inscription dimanche 28 novembre 2004 Statut Membre Dernière intervention 2 août 2011
22 avril 2009 à 15:38
Hello,

1/ Pas besoin de poster 2 fois le meme post (regarde ma signature et le reglement).

2/ Utilise javascript.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
   <head>
       <title>Fiche_Physique</title>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
              <link rel="stylesheet" media="screen" type="text/css" title="Design" href="autres.css" />

<script type="text/javascript">
     function check(pFirst,pName)
     {
         var first = pFirst.titre;
         var result = pFirst.Nat_jur
                if(first.value "SA" || first.value "SARL")
        {
            result.options[1].style.display = "none";
        } else {
            result.options[1].style.display = "block";
        }
     }
</script>

   </head>
  
 
<form method="post" action="cible_autres.php" name="form1" >
   
            TITRE



             <select name="titre" onchange="check(this.form);">
              
            <option value="SA">SA</option>
            <option value="SAS">SAS</option>
            <option value="SARL">SARL</option>
            <option value="URL">URL</option>
            <option value="SCP">SCP</option>
            <option value="SCI">SCI</option>
         
           </select>
         
   

        
        <select name="Nat_jur">
              
        <option value="PRIVE">PRIVE</option>
        <option value="PUBLIC">PUBLIC</option>

        </select>
  </form>
 
</html>

-- Orange73 --
"L'homme n'est pas fait pour travailler, la preuve c'est que cela le fatigue" (Voltaire)
0
grimpator Messages postés 4 Date d'inscription mercredi 22 avril 2009 Statut Membre Dernière intervention 23 avril 2009
23 avril 2009 à 08:41
Merci beaucoup!
0
Rejoignez-nous