...

View Full Version : Javascript event problem



jacque99
11-04-2011, 03:06 PM
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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum