Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

Javascript event problem

Javascript coding ..

Moderators: macek, egami, gesf

Javascript event problem

Postby jacque99 » Fri Nov 04, 2011 5:08 am

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:

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




Voici le script :

Code: Select all
<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>
jacque99
New php-forum User
New php-forum User
 
Posts: 12
Joined: Tue Sep 07, 2010 6:06 am

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.