Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: form validation

  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    i have a form... quie big all i want to do is promt the user that he/she has missed a field..

    Code:
    <script>
    function checkData(box)
    {
    	if(document.form1.elements[box].value == "")
    	{
    		alert("no!")
    		document.form1.elements[box].focus()
    		}
    }
    </script>
    that was in ma head of ma docuemnt...

    Code:
    <INPUT NAME="UserName" size="20" onBlur="checkData">
    and that was in my form... woz wrong wiv it ?
    i get an error
    any advice plz
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    d31
    d31 is offline
    Member
    Join Date
    Oct 2003
    Location
    Sydney, Australia
    Posts
    39
    Member #
    3423
    Well post the error.

  4. #3
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    Originally posted by kirman
    Code:
    <INPUT NAME="UserName" size="20" onBlur="checkData">
    That is what's causing your error.
    You are trying to call the function checkData onBlur in the input field. The problem with that is you aren't including the ( ) 'sand the function's argument when you do.

    For example try this:
    [minicode]<INPUT NAME="UserName" size="20" onBlur="checkData(this)">[/minicode]

    If you still get an error when trying this (as well as in the future when posting javascript problems), follow d31's advice and post the error you get as well.
    - Brian


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:23 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com