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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:39:50+00:00 2026-05-27T05:39:50+00:00

I posted a question before about a form submitting to asp. I am more

  • 0

I posted a question before about a form submitting to asp. I am more familiar with php so I decided to change the form to submit to php instead. The only thing is the form is created within an asp file contact.asp and I have submitted this to a contact.php page.

The problem is I am now trying to include validation into the head section of the asp page using JavaScript this is for an empty name, email and phone check. I have first tried just the name and email as:

The JavaScript I am using is as follows:

<script type="text/javascript">

function validateForm() {
  var x=document.forms["myForm"]["fname"].value;
  if (x==null || x=="") {
    alert("First name must be filled out");
    return false;
  }
}

function validateForms() {
  var x=document.forms["myForm"]["email"].value;
  var atpos=x.indexOf("@");
  var dotpos=x.lastIndexOf(".");
  if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
    alert("Not a valid e-mail address");
    return false;
  }
} 

</script>

I would highly appreciate any help with this.

Thanks

Edit: The JavaScript is not working it just submits the form without any validation

  • 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-27T05:39:51+00:00Added an answer on May 27, 2026 at 5:39 am

    You’re declaring the same function twice. That won’t work. Rename one of the functions or merge them as one.

    Also, make sure to actually call the function.

    <form method="" action="" onsubmit="return validateForms();" id="myForm">
    

    And make sure that the fields are called correctly.

    <input name="email" type="email" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have posted a question about a similar issue before, and managed to fix
I have posted a question about a similar issue before, and managed to fix
I know this question has been posted before... but I haven't found any answer
Note this question was originally posted in 2009, before C++11 was ratified and before
I posted this question: https://stackoverflow.com/questions/418597/java-and-net-for-php-programmer and the answers I was given didn't really help
I posted a question last night about Java Reflection and am discovering compiler warnings
I posted a question about a thread pattern today, and almost everyone suggested that
Stumped here. Posted a similar question before. We have a pretty large WPF app
I recently posted a question here about some memory issues I was having. I've
I posted a question similar to this earlier, however, after thinking about it and

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.