468,557 Members | 2,274 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,557 developers. It's quick & easy.

validation for login page with radio button

validation for login page with radio button, if click on super admin radio button,i s

Expand|Select|Wrap|Line Numbers
  1. <td><font color="white">Role</font></td>
  2. <td>
  3.  <input type="radio" id="sa" name="admin"><font color="white">Superadmin</font></input>
  4.  <input type="radio" id="ad" name="admin"><font color="white">Admin</font></input>
  5.  </td>
  6.  </tr>
  7.  <tr>
  8.  <td><font color="white">Login name</font></td>
  9.  <td><input type="text" name="loginname" id="ln"></input></td>
  10.  </tr>
  11.  <tr>
  12.  <td><font color="white">Password</font></td> <td><input type="password" name="password" id="pwd"></input></td>
  13. <td><font color="white">Role</font></td>
  14. <td>
  15.  <input type="radio" id="sa" name="admin"><font color="white">Superadmin</font></input>
  16.  <input type="radio" id="ad" name="admin"><font color="white">Admin</font></input>
  17.  </td>
  18.  </tr>
  19.  <tr>
  20.  <td><font color="white">Login name</font></td>
  21.  <td><input type="text" name="loginname" id="ln"></input></td>
  22.  </tr>
  23.  <tr>
  24.  <td><font color="white">Password</font></td>
  25.  <td><input type="password" name="password" id="pwd"></input></td>
  26.  </tr>
  27.  <tr>
  28.  <td><input type="submit" value="submit" onclick="return valid()" ></input></td>
  29.  </tr>
  30.  </tr>
  31.  <tr>
  32.  <td><input type="submit" value="submit" onclick="return valid()" ></input></td>
  33.  </tr>
May 6 '13 #1
2 2201
gits
5,390 Expert Mod 4TB
what is your exact issue with the posted code?
May 6 '13 #2
Sherin
77 64KB
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.   <head>
  3.  
  4.   function ValidateForm(form){
  5.   ErrorText= "";
  6.   if ( ( form.gender[0].checked == false ) && ( form.gender[1].checked == false ) ) 
  7.   {
  8.   alert ( "Please choose your Gender: Male or Female" ); 
  9.   return false;
  10.   }
  11.   if (ErrorText= "") { form.submit() }
  12.   }
  13.  
  14.  </head>
  15.   <body>
  16.  <form name="feedback" action="#" method=post>
  17.    Gender: 
  18.      <input type="radio" name="gender" value="Male"> Male
  19.   <input type="radio" name="gender" value="Female"> Female
  20.  
  21.  
  22.     <input type="submit" name="SubmitButton" value="Submit" onClick="ValidateForm(this.form)">
  23.  <input type="reset" value="Reset">
  24.   </form> 
  25.   </body>
  26.   </html>
Jan 1 '21 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by amit.purohit | last post: by
5 posts views Thread by John Bonds | last post: by
2 posts views Thread by harleyman1974 | last post: by
4 posts views Thread by Charlie Brookhart | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.