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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:52+00:00 2026-06-08T10:58:52+00:00

I am trying to make an error if the textbox (First_Name) is left empty.

  • 0

I am trying to make an error if the textbox (First_Name) is left empty. For example, if the firstname field is left empty, the user will receive the following error: “Please enter your first name” Nothing happens when I click the submit button after leaving the field blank though…

<HTML>
<HEAD>
<TITLE>this is a test page</TITLE>
<script language="javascript" type="text/javascript">
<!--
function CheckForm()
{
  var formObj = document.getElementById("Data");
  var firstname = formObj.FIRST_Name.value;

    if(notEmpty(firstname, "Please enter your first name")){                        

    return true;}

    return false;
    }

function notEmpty(elem, helperMsg){
    if(elem.value.length == 0){
        alert(helperMsg);
        elem.focus(); // set the focus to this input
        return false;
    }
    return true;
}

</script>
</HEAD>
<BODY>
<div style="background: #CCCC99">
<HR><FORM id="Data" onsubmit="return CheckForm()" >
<P>First Name: <input type=text name=FIRST_Name maxlength=15 size=15>
</P>
<input type=submit value="Submit Products Registration Form" style="width: 220px"><input type=reset value="Reset">
</form>
</div>
</BODY>
</HTML>
  • 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-06-08T10:58:53+00:00Added an answer on June 8, 2026 at 10:58 am

    firstname is the elements value but you pass it to notEmpty as an element, instead use

    if(notEmpty(formObj.FIRST_Name, "Please enter your first name")){ 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to install memcached-1.2.8-repcached-2.2.1 I have the following error after running make :
I get this error when trying to make the executable, the code compiles correctly
I'm writing some error checking and trying to make use of an boolean array
I'm trying to make a notification in Android. But i get the error in
I seem to be getting the above error when trying to make a callable
I'm trying make a login window where a user is prompted to enter their
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I'm trying to make a general error handler for an iPhone app that brings
I have a very simple error popup I'm trying to make. When I call
I'm trying to make a c# IRC client. My problem: I have a TextBox

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.