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 6719193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:03:49+00:00 2026-05-26T09:03:49+00:00

i am making a user registration form with validation.thats my simple form field. <tr>

  • 0

i am making a user registration form with validation.thats my simple form field.

<tr>
    First Name:
    <input type="text" name="fname" id="letters"  /><span id="error" style="color:red;"></span>
<tr>

<tr>  
    Last Name:
    <input type="text" name="lname"  id="letters1"  /><span id="error1" style="color:red;"></span>
</tr>
<input type="submit" value="submit" name="submit" />

i am using a validation function on submit onsubmit=”return ValidateForm();

in the validation function

function ValidateForm(){

    if (document.reg.fname.value=="" || !document.reg.fname.value.match(/[^\s]/))
    {
        document.getElementById("error").innerHTML = "enter first Name"
        return false;
    }
    else
    {
        document.getElementById("error").innerHTML = '';

    }

    if (document.reg.lname.value=="" || !document.reg.lname.value.match(/[^\s]/))
    {
        document.getElementById("error1").innerHTML = "enter last Name"
        return false;
    }
    else{
        document.getElementById("error1").innerHTML = '';

    }

but for try when i submit the button..the ERROR MESSAGE shows only with first input box, and when i fill the first box then submit ..this time the error MESSAGE shows with Second text box. i am wanted to show all error message with same time.

  • 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-26T09:03:49+00:00Added an answer on May 26, 2026 at 9:03 am

    Remove the return false between the tests

    For a quick fix to your code I would do something like this

    DEMO HERE

    function ValidateForm(theForm) {
        var error1 = (theForm.fname.value=="" || !theForm.fname.value.match(/[^\s]/))
        document.getElementById("error1").innerHTML = (error1)?"enter first Name?":"";
        var error2 = (theForm.lname.value=="" || !theForm.lname.value.match(/[^\s]/));
        document.getElementById("error2").innerHTML = (error2)?"enter last Name":"";
        return !error1 && !error2
    }
    

    and have

    <form onsubmit="return ValidateForm(this)">
    <table>
      <tr>
        <td>First Name: <input type="text" name="fname" id="letters"  /><span id="error1" style="color:red;"></span></td>
      </tr>
      <tr>  
        <td>Last Name:  <input type="text" name="lname"  id="letters1" /><span id="error2" style="color:red;"></span></td>
      </tr>
    </table>
    <input type="submit" value="submit" name="Submit" />
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a registration form which will have the user put in his birthday.
I am making a registration form. When a user is selecting a username I
I'm making practice with CakePHP user registration validation but I get some error from
I'm making a form for user registration. Here's what my template looks like: <h1>Register</h1>
I'm making a user control, and I manually draw the text string, but I
Hey, I'm making a simple user friendly css editor using Prototype. Anyway, I was
I'm making user settings form, and stuck with HAML: = form_tag('/') - [1,2,3].each do
I have a registration form that when the user enters in valid registration data
I need to stop user making multiple clicks on a JButton while the first
I am going to be making a small user system but I have questions.

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.