Activer/désactiver bouton submit en fin du questionnaire
Bonjour
Je voudrais savoir comment faire pour activer le bouton submit "Valider" à la fin du questionnaire, lorsque l'utilisateur cliquera sur "Valider", il y aura un message qui le remercie d'avoir répondu aux questions et que le bouton "Valider" redevient grisé.
J'ai essayé pas mal de choses, je vous montre mon code JS :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function affiche_bouton(form1)
{
var isChecked=false;
for (i=0; i<document.getElementsByTagName("input").length; i++)
if (document.getElementsByTagName("input")[i].type=="radio")
if (document.getElementsByTagName("input")[i].checked)
isChecked=true;
if (isChecked)
{
document.getElementById('submite').disabled='';
} else {
document.getElementById('submite').disabled='disabled';
}
}
</SCRIPT> |
Un extrait de mon source XHTML:
Code:
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
| <p><b>Question 1 : blablablabla ?</b></p>
<table width="500" border="1">
<tr>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Très satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Moyennement satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Pas satisfait</td>
</tr>
</table>
<p><b>Question 2 : blablablabla ?</b></p>
<table width="500" border="1">
<tr>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Très satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Moyennement satisfait</td>
<td><input type="radio" name="rep1" id="radio" value="radiobutton" />
Pas satisfait</td>
</tr>
</table>
<input type="submit" name="button" value="Valider" id="submite" disabled="disabled" /> |
Mon problème, c'est que dès que j'ai répondu à la question 2, le bouton "Valider" reste grisé :s
Avez-vous une solution à ça svp ?
Merci de m'aider ;)