Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validateForm()
- {
- var host=document.forms["form"]["host"].value
- var username=document.forms["form"]["username"].value
- var password=document.forms["form"]["password"].value
- var prefix=document.forms["form"]["prefix"].value
- var email=document.forms["form"]["email"].value
- var atpos=email.indexOf("@");
- var dotpos=email.lastIndexOf(".");
- if (host==null || host=="" || host=="Host Name")
- {
- alert("Host name must be filled out");
- return false;
- }
- if (username==null || username=="" || username=="Username")
- {
- alert("Username must be filled out");
- return false;
- }
- if (password==null || password=="" || password=="Password" || password=="Re-enter Password")
- {
- alert("Password must be filled out");
- return false;
- }
- if (email==null || email=="" || email=="Email" || email=="Re-enter Email")
- {
- alert("Email must be filled out");
- return false;
- }
- if (prefix==null || prefix=="" || prefix=="Prefix")
- {
- alert("Table prefix name must be filled out");
- return false;
- }
- if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length)
- {
- alert("Not a valid e-mail address");
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement