Bonjour à tous !

Beh voila, j'ai un p'tit ennui sur un code (comme bcp de monde ici je crois )

En fait je génère une page avec plusieurs formulaires portant les noms "form1", "form2", "form3", ...
Dans ces form j'ai à chaque fois un input type="radio" et 2 input type="hidden".
Plus bas, j'ai un bouton qui appele une fonction javascript qui submitera le form où l'input type="radio" est à checked=true.

Voici mon 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
 
<head>
  <script language="javascript">
  function test()
  {
    /* recherche du radio sélectionné */
    for (i=1 ; document.eval("form"+i).clef.checked != true ; i++)
    alert(document.eval("form"+i).clef.value);
  }
  </script>
</head>
<body>
<table>
  <tr>
    <td>&nbsp;</td>
    <td class='intext2'>&nbsp;N° Facture&nbsp;</td>
    <td class='intext2'>&nbsp;Date Facture&nbsp;</td>
    <td class='intext2'>&nbsp;Nom&nbsp;</td>
    <td class='intext2'>&nbsp;Description&nbsp;</td>
    <td class='intext2'>&nbsp;Marque&nbsp;</td>
  </tr>
  <tr>
    <form name='form1' action='print_facture.php' method='get'>
      <input type='hidden' name='NUM_FAC' value='45' />
      <input type='hidden' name='CH_DEPL' value='off' />
      <td><input type='radio' name='clef' value='1-1-1' onClick="document.getElementById('submit_button').disabled=false" /></td>
    <td>45</td>
    <td>03/12/2005</td>
    <td>Mr Toto toto</td>
    <td>Seche linge</td>
    <td>AEG</td>
  </form>
</tr>
  <tr>
    <form name='form2' action='print_facture.php' method='get'>
      <input type='hidden' name='NUM_FAC' value='46' />
      <input type='hidden' name='CH_DEPL' value='on' />
      <td><input type='radio' name='clef' value='1-2-1' onClick="document.getElementById('submit_button').disabled=false" /></td>
    <td>46</td>
    <td>04/12/2005</td>
    <td>Mr Tata tata</td>
    <td>Lave linge</td>
    <td>Miele</td>
  </form>
</tr>
</table>
<br/>
<input id="submit_button" disabled="disabled" type="button" value="Voir la facture >>>" onclick="javascript:test()" class="submit" />
Pour l'instant la Fonction test ne fait pas encore le submit du form mais bon vu que ca plante... En fait je suis quasi sûr que c'est mon eval("form"+i) qui fait tout planter... peut être qqu a une meilleure idée ?

Merci d'avance, Julien.