473,699 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Validation - Verify there is a name entered in forms text box

67 New Member
Hello,

I have a form that i use ASP to process the form to my access database. It works well but I'm struggling to get the javascript validation to work. I have posted a small version of my form to see if any of you know why this isn't working. I believe this is supposed to have a box pop up to say "You must enter a first name." when you leave the text box blank. However, I get nothing. Any thoughts are greatly appreciated. Thanks - Jerry

Expand|Select|Wrap|Line Numbers
  1. <html><head><title>Registration Page</title>
  2. <script Language="JavaScript">
  3. <!--
  4. function Form1_Validator(theForm)
  5. {
  6. if (theForm.firstname.value == "")
  7. {
  8. alert(You must enter a First Name.");
  9. theForm.firstname.focus();
  10. return (false);
  11. }
  12. }
  13. //--></script>
  14.  
  15. </head>
  16.  
  17. <form method="post" action="register_users.asp" onsubmit="return Form1_Validator(this)">
  18.  
  19. <p><pre>
  20. <h3><font color="navy">Step 1: User Information</font></h3>
  21. <p><b><font face="comic sans ms">First Name:    <input type="text" name="firstname" size="25"/>
  22.  
  23. <input type="submit" value="Click here to Register"/>
  24. <input type="reset" value="Erase and Start Over"/></p>
  25. </form>
  26. </body>
  27. </html>
Nov 2 '08 #1
1 2762
jerrydigital
67 New Member
please disregard my last post, i was way off but i have figured out the answer.
thanks for looking thought, take care
Nov 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8611
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I keep getting errors thrown that I can't verify because the form processes onto itself too quickly for me to check the Javascript errors) because the select multiple form element name has to be in the form of "var" because PHP will then recognize...
4
4260
by: annoyingmouse2002 | last post by:
Hi there, sorry if this a long post but I'm really just starting out. I've been using MSXML to parse an OWL but would like to use a different solution. Basically it reads the OWL (Based on XML) and puts values in a number of arrays and then puts the contents of the array in a HTML table. I'd like to keep the array structure. I've checked out all sorts of different javascript parsers but have not met with a great deal of success with any...
8
1715
by: Sue | last post by:
In this code why is it that when I press the SUBMIT button the focus only goes back to the Numeric field. What do I need to do to correct this problem? Sue <html>
5
2683
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
10
2524
by: vinu | last post by:
I have a javascript file named select.js. This is a file which is use to pop up a calendar, when clicked on a calendar icon in an ASP file. have a close button in the calendar. When i click on the button, th calendar is not closing. here is the select.js file x999NS4compatible = (document.layers); var x999IE4compatible = (document.all); var x999dayabbs = ;
2
2625
by: GreggTB | last post by:
Hello, I'm trying to perform a very simple validation of user input. I want to verify that the user entered a six-digit string consisting entirely of numbers. So anything from 000000 to 999999 is considered valid. The problem that I'm having is getting the validation to work on the entire string. In other words, 000000 is okay but 000000000000 is also returning as a match. Here's a quick code block...I have something along these lines.......
1
5270
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address entered is a valid e-mail address format. We've added a CustomValidator to perform this validation. We have the server-side validation working fine, but now we need to add some client-side validation via JavaScript. We are having difficulties...
27
4745
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
13
323
by: Mtek | last post by:
Hi, We have a form defined with buttons like this: <a class="save_menu" href="javascript:document.Detail_Screen.action = 'savedata.php?screen=EDIT';document.Detail_Screen.submit();">Update</ a> The form also has an onSubmit action to vall a validation routine:
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.