Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- In Response to a Yahoo Answers Question -->
- <html>
- <head>
- <script type="text/javascript" language="Javascript">
- function validateForm(){
- var theForm = document.forms["myForm"];
- var theReqFields = ['bizname','fullname'];
- var formPass = 0;
- for( var x in theReqFields){
- if(theForm[x].value.length === 0){
- formPass++;
- }
- }
- if(formPass === 0){
- return true;
- }else{
- alert('Some Required Fields Are Empty. Please Correct before continueing.');
- return false;
- }
- }
- </script>
- </head>
- <body>
- <form name="myForm" onsubmit="return validateForm();">
- Biz Name: <input type="text" name="bizname"><br>
- Full Name: <input type="text" name="fullname"><br>
- Email: <input type="text" name="email"><br>
- <input type="submit" value="Send">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment