Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Please help!! Need to solve this problem for class thank you!!

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help!! Need to solve this problem for class thank you!!

    I am a begginner at html and javascript, I have this problem for class and I cannot figure it out, I know it must be something simple. I am trying to create a page that has a form, if you do not fill out the form when you press submit I want an error message to tell you it cannot be submitted you did not fill out the form.
    PLEASE HELP!!!!

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>JavaScript Practice</title>
    <meta charset="utf-8">
    <script type="text/javascript">

    <!-- function validateForm() {
    if (document.forms[0].userName.value == "" )
    { alert("Name field cannot be empty.");
    return false; } // end if alert("Name and age are valid.");
    return true; } // end function validateForm // -->

    </script>
    </head>

    <body>
    <h1>JavaScript Form Handling</h1>
    <form method="post" action="http://webdevfoundations.net/scripts/formdemo.asp"
    onsubmit="return validateUser();">
    <label>Name: <input type="text" name="userName"></label>
    <br>
    <input type="submit" value="Send information">

    </form>
    </body>
    </html>


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Please help!! Need to solve this problem for class thank you!!

    Please read Announcements - What's Wrong With My Code? , especially point 10. Thread moved from What's wrong with my code

Similar Threads

  1. Need help to solve this problem
    By ahanf in forum Object Oriented Programming
    Replies: 1
    Last Post: June 3rd, 2012, 05:00 AM
  2. need help to solve the problem
    By priyadaradi in forum Member Introductions
    Replies: 1
    Last Post: May 24th, 2012, 10:44 AM
  3. Please help me solve this problem, this is really urgent!
    By KalvinL7 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 1st, 2012, 02:55 PM
  4. help me to solve my problem
    By miszIna in forum Object Oriented Programming
    Replies: 3
    Last Post: February 14th, 2011, 09:40 AM
  5. Questions about a Problem I'm trying to solve
    By DarkEssence in forum Java Theory & Questions
    Replies: 4
    Last Post: March 17th, 2010, 06:29 AM