need help with validity script

  • gt8ost4l
  • Student
  • Student
  • User avatar
  • Posts: 99

Post 3+ Months Ago

im really stuck on this form validation so far i was only able to get it to check for the email or password but not if there both blank all i got is

JAVASCRIPT Code: [ Select ]
 
 
function validateLoginForm(){
 
var screenname = document.getElementById("definedemail");
 
var hiddeninput = document.getElementById("definedpassword");
 
 
 
if(screenname.value==''){
 
alert("Please enter a valid Email");
 
screenname.focus();
 
return false;
 
}
 
if(screenname.value.toLowerCase()=="user name"){
 
alert("Please enter a valid User Name");
 
screenname.select();
 
screenname.focus();
 
return false;
 
}
 
if(hiddeninput.value==''){
 
alert("Please enter a valid Password");
 
hiddeninput.focus();
 
return false;
 
}
 
function blankfields(){
if(screenname.hiddeninput.length == 0){
screenname.hiddeninput.IsValid = false
alert("document.screenname.hiddeninput")
screenname.hiddeninput.select();
screenname.hiddeninput.focus();
return false;
 
}
 
}
 
return true;
 
}
 
 
 
function initailizescreenname(){
 
var txtUN=document.getElementById("definedemail");
 
if(txtUN.value.toLowerCase()=="screen name"){
 
txtUN.value="";
 
txtUN.className = "hiddenfield";
 
}
 
}
 
function setscreenname(){
 
var txtUN=document.getElementById("definedemail");
 
if(txtUN.value==""){
 
txtUN.value="screen name";
 
txtUN.className = "loginemail";
 
}
 
}
 
 
 
 
 
  1.  
  2.  
  3. function validateLoginForm(){
  4.  
  5. var screenname = document.getElementById("definedemail");
  6.  
  7. var hiddeninput = document.getElementById("definedpassword");
  8.  
  9.  
  10.  
  11. if(screenname.value==''){
  12.  
  13. alert("Please enter a valid Email");
  14.  
  15. screenname.focus();
  16.  
  17. return false;
  18.  
  19. }
  20.  
  21. if(screenname.value.toLowerCase()=="user name"){
  22.  
  23. alert("Please enter a valid User Name");
  24.  
  25. screenname.select();
  26.  
  27. screenname.focus();
  28.  
  29. return false;
  30.  
  31. }
  32.  
  33. if(hiddeninput.value==''){
  34.  
  35. alert("Please enter a valid Password");
  36.  
  37. hiddeninput.focus();
  38.  
  39. return false;
  40.  
  41. }
  42.  
  43. function blankfields(){
  44. if(screenname.hiddeninput.length == 0){
  45. screenname.hiddeninput.IsValid = false
  46. alert("document.screenname.hiddeninput")
  47. screenname.hiddeninput.select();
  48. screenname.hiddeninput.focus();
  49. return false;
  50.  
  51. }
  52.  
  53. }
  54.  
  55. return true;
  56.  
  57. }
  58.  
  59.  
  60.  
  61. function initailizescreenname(){
  62.  
  63. var txtUN=document.getElementById("definedemail");
  64.  
  65. if(txtUN.value.toLowerCase()=="screen name"){
  66.  
  67. txtUN.value="";
  68.  
  69. txtUN.className = "hiddenfield";
  70.  
  71. }
  72.  
  73. }
  74.  
  75. function setscreenname(){
  76.  
  77. var txtUN=document.getElementById("definedemail");
  78.  
  79. if(txtUN.value==""){
  80.  
  81. txtUN.value="screen name";
  82.  
  83. txtUN.className = "loginemail";
  84.  
  85. }
  86.  
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 121 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.