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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:59:38+00:00 2026-05-10T23:59:38+00:00

I have a simple email address sign up form as follows: <form action= id=newsletterform

  • 0

I have a simple email address sign up form as follows:

<form action='' id='newsletterform' method='get'>       <input type='text' name='email' class='required email' id='textnewsletter'  />       <input type='submit' id='signup' /> </form> 

Here’s what I want to be able to do:

  • Validate the form to look for an empty string or a incorrectly filled out email address one the user clicks submit or hits enter.
  • If one of the above happens (empty string etc), I would like to generate an error to let the user know.
  • Then once the user fills out a correctly formed email address and hits submit (or enter) I want the form to send the email address to wherever I specify in the jQuery code and then generate a little ‘Thank you for signing up notice’, all without reloading the browser.

I have looked at too many tutorials and my eyes are pretty much aching at this stage, so please don’t point me to any urls (I most likely have been there).

If someone could provide a barebone outline of what to do It would be so much appreciated.

  • 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. 2026-05-10T23:59:39+00:00Added an answer on May 10, 2026 at 11:59 pm

    First, please be sure you do all of your validation on the server-side. I like to get my forms working without any JavaScript whatsoever. I am assuming you have done that much.

    ****ORIGINAL ANSWER***

    Then, change your ‘submit’ element to a button element. On the OnClick of the button element, run a JavaScript function that validates. Lots of samples on how to do that as you know.

    If the validation fails, send up alerts. If it is successful, use JavaScript to submit the form.

    ****NEW, TOOL USING ANSWER***

    You can also employ JQuery as (orip points out) and it’s plugins to do this. They handle a lot of the hard work. Please make sure my comments are telling the correct story. this code also does the AJAX submitting.

    <!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'> <head>     <!-- Load JQuery on your page -->     <script src='http://code.jquery.com/jquery-latest.js'></script>     <!-- Load JQuery validation sytles and (rules?) on your page -->     <link rel='stylesheet' href='http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.css' type='text/css' media='screen' />     <!-- Load JQuery validation plugin on your page -->     <script type='text/javascript' src='http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js'></script>     <!-- Load JQuery form plugin on your page -->     <script type='text/javascript' src='http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js'></script>   <script type='text/javascript' language='javascript'>     //Wait until the document is loaded, then call the validation.  Due to magic in JQuery or the plugin     //  this only happens when the form is submitted.   $(document).ready(function(){         //When the submit button is clicked         $('#signup').click(function() {             //if the form is valid according to the fules             if ($('#newsletterform').valid()) {                 //Submit the form via AJAX                 $('#newsletterform').ajaxForm(function() {                      //this alert lets me know the submission was successfull                     alert('Thank you!'); });                  }             })   });   </script>     <!-- Just some styles -->     <style type='text/css'>             * { font-family: Verdana; font-size: 96%; }             label { width: 10em; float: left; }             label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }             p { clear: both; }             .submit { margin-left: 12em; }             em { font-weight: bold; padding-right: 1em; vertical-align: top; }     </style>   </head> <body>     <form action='' id='newsletterform' method='get'>         <!-- The classes assigned here are where the validation rules come fome.           This is required, and it must be an email -->         <input type='text' name='email' class='required email' id='textnewsletter'  />         <input type='submit' id='signup' />     </form> </body> </html> 

    This isn’t the tightest code you could write, but it will serve as an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The problem is not in the function that you are… May 11, 2026 at 2:21 pm
  • added an answer In short, CAS is the security sandbox for .NET. Local… May 11, 2026 at 2:21 pm
  • added an answer I would consolidate these top feeds into an OPML file.… May 11, 2026 at 2:21 pm

Related Questions

I'm writing a very simple flash app (AS 2) to sign users up to
I'm building a small website which will have FBA enabled (SqlMembershipProvider) and I want
As a way of evaluating Web2Py I tried to reimplement a web page in
I am working on a small intranet site for a small company, where user

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.