Javascript event problem

Répondre
jacque99
le 04/11/2011 à 14:09
jacque99
Hello everyone,
If I type the name, and I check and Gender Scholar, my button will

appear
What I am looking to:
Check my buttons, and when I start typing the name, the button

Submit appear, st if I delete the text, the Submit button

disappear

Here's the script:

*****************************************


<head>
<script type="text/javascript" src="jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#commentForm").validate();
});
function check_required(){

//alert(document.getElementById('rdo_boursier_oui').checked);
//alert(document.getElementById('txt_lastname').value != "");
if((document.getElementById('rdo_boursier_oui').checked == true

|| document.getElementById('rdo_boursier_non').checked == true) &&

(document.getElementById('rdo_sexe_eleve_m').checked == true ||

document.getElementById('rdo_sexe_eleve_f').checked == true)

&& (document.getElementById('txt_lastname').value != "" )


)
{
document.getElementById

('submit_etape2').style.display='block';
}else{
document.getElementById

('submit_etape2').style.display='none';
}
}
</script>
</head>


<form action="#" method="post" id="commentForm">
<input class="submit" type="submit" name="submit_etape2"

id="submit_etape2" value="" style="display:none;"/>

<p class="p_float">
<label for="lastname">Votre nom<span

class="required_red">*</span></label>
<input type="text" name="txt_lastname"

id="txt_lastname" value="" class="required" minlength="3"

onchange="check_required();"
/>
</p>


<p class="p_float rdo">
<label for="boursier">Boursier<span

class="required_red">*</span></label>

<input type="radio" name="rdo_boursier"

id="rdo_boursier_oui" value="" class="rdo_sexe_eleve snd_inscription

required" onclick="check_required();"/>Oui
<input type="radio" name="rdo_boursier"

id="rdo_boursier_non" value="" class="rdo_sexe_eleve snd_inscription

required" onclick="check_required();"/>Non
</p>

<p class="p_float rdo">
<label for="sexe">Sexe<span

class="required_red">*</span></label>
<input type="radio"

name="rdo_sexe_eleve" id="rdo_sexe_eleve_m" class="rdo_sexe_eleve

snd_inscription required" onclick="check_required();" value="">M
<input type="radio"

name="rdo_sexe_eleve" id="rdo_sexe_eleve_f" class="rdo_sexe_eleve

snd_inscription required" onclick="check_required();" value="">F
</p>



</form>
jacque
LupusMic
le 07/11/2011 à 00:06
LupusMic
Tu devrais réécrire ta question en français…
Développeur récurrent, procédural et relationnel. Caustique soupe-au-lait.
jacque99
le 10/11/2011 à 19:47
jacque99
Je pense quelque chose de ce type :
http://babylon-design.com/eviter-conflit-javascript-window-onload/
jacque
Répondre

Ecrire un message

Votre message vient d'être créé avec succès.
LoadingChargement en cours