Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4588766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:58:08+00:00 2026-05-21T21:58:08+00:00

Hello again everyone i am working on this <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0

  • 0

Hello again everyone
i am working on this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Form</title>
<script type="text/javascript">
</script>
</head>
<body>
<h2>**Form**</h2>
<form  name=form method="post" action="javascript" subject=RSVP" enctype="text/plain" >
<input type=text name="first" size="20"> First Name<BR>
<input type=text name="last" size="20"> Last Name<BR>
<input type="text" name="email" size="20"> E-Mail<BR><BR>
<input type="submit" value="Submit">
<input type="reset" value="Clear Form"><br>
</form>
 </body>
 </html>

I am getting really confused here.. I need to have a onsubmit form handler and a create validation script. Ok now if I am right the validation script is the the function that needs to be placed right? sorry i know some of you guys might think this is easy but I am still learning. Now I have examples in my book of it but they only due one at a time. Is there a way you can do a onsubmit of all or does it have to be one at a time? thanks

ok I have this one i am working on..

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Form</title>
   <script type="text/javascript">
    <!--
   function validate_form()
    {
valid = true;

    if ( document.contact_form.contact_first.value == "" )
    {
            alert ( "Please fill in the 'Your Name' box." );
            valid = false;
     }

    return valid;
     }

 //-->

 </script>
 </head>
  <body>
 <h2>**Form**</h2>
 <form  name="contact_form"  method="post" action="javascript" onSubmit="return  validate_form();"> 
 <input type=text name="contact_first" size="20"> First Name<BR>
 <input type=text name="contact_last" size="20"> Last Name<BR>
 <input type="text" name="contact_email" size="20"> E-Mail<BR><BR>
 <input type="submit" value="Submit">
 <input type="reset" value="Clear Form"><br>
 </form>



 </body>

</html>

now Can i just copy the function for the other two or how do i do the one for the email?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:58:09+00:00Added an answer on May 21, 2026 at 9:58 pm

    I’ve added an example here of how to do it:

    http://jsfiddle.net/tomgrohl/JMkAP/

    I added an onsubmit handler to the form:

    <form method="post" action="javascript" enctype="text/plain" onsubmit="return valForm(this);">
    

    And added this at the top of the page, a simple validation function:

    <script type="text/javascript">
    function valForm( form ){
    
        var firstVal, lastVal, emailVal, error = '';
    
        firstVal= form.first.value;  
        lastVal= form.last.value;
        emailVal= form.email.value;
    
        //OR
        //firstVal= document.getElementById('first').value;  
        //lastVal= document.getElementById('last').value;
        //emailVal= document.getElementById('email').value;
    
        if( firstVal.length == 0){
            error += 'First name is required\n';
        }
    
        if( lastVal.length == 0){
            error += 'Last name is required\n';
        }
    
        if( emailVal.length == 0){
            error += 'Email is required\n';
        }
    
        if( error ){
            alert( error );
            return false;
        }
    
        return true;
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello again dearest Experts, I have an ecommerce site at http://www.millenniumhealthproducts.com The site was
Hello again stackoverflow! So i build this script: <?php $xmlurl = 'http://api.ipinfodb.com/v2/ip_query.php?key=apikey&ip=127.0.0.100&timezone=false'; $xml =
Hello everyone I been trying get php uploader working but having a lot of
Hello everyone it is me again with another question. The booking system located here
hello everyone it is me again! i've got few problems too. i am deveoping
This code alert(Hello again! This is how we + \n + add line breaks
Hello again and please forgive me for posting again. I do this when I
Hello again ladies and gents! OK, following on from my other question on ASP.NET
Hello again Stackoverflow people! Assume I have these words: smartphones, smartphone I want to
Hello I've runned in to a problem again that I can't solve on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.