fork(1) download
  1. function validate_form ( )
  2. {
  3. valid = true;
  4.  
  5. if ( document.form.fname.value == "" )
  6. {
  7. alert ( "Please fill in the 'First Name'." );
  8. valid = false;
  9. }
  10.  
  11. if ( document.form.lname.value == "" )
  12. {
  13. alert ( "Please fill in the 'Last Name'." );
  14. valid = false;
  15. }
  16. if ( document.form.branch.value == "" )
  17. {
  18. alert ( "Please fill in the 'Branch'." );
  19. valid = false;
  20. }
  21.  
  22. if ( document.form.aiit.value == 0 )
  23. {
  24. alert ( "Please fill in the 'Applied IIT'." );
  25. valid = false;
  26. }
  27.  
  28. if ( document.form.eid.value == "" )
  29. {
  30. alert ( "Please fill in the 'Email Id'." );
  31. valid = false;
  32. }
  33.  
  34. var x=document.form.eid.value;
  35. var atpos=x.indexOf("@");
  36. var dotpos=x.lastIndexOf(".");
  37. if(atpos <1 || dotpos < atpos+2 ||dotpos+2>=x.length)
  38. {
  39. alert("Not a valid e-mail address");
  40. valid=false;
  41. }
  42.  
  43. var branch=document.form.branch.value;
  44. if(branch.length>=4)
  45. {
  46. alert("please enter valid branch name.")
  47. valid=false;
  48. }
  49. return valid;
  50.  
  51. }
  52.  
Success #stdin #stdout 0.28s 213184KB
stdin
Standard input is empty
stdout
Standard output is empty