SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict seanmayhew's Avatar
    Join Date
    Aug 2002
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    All valid fields causes Javascript error

    This is the portion of a javascript form validation file that is bothering me. the validation works great with no errors until all of the fields are valid the page still works fine but I get the script error:

    Error: 'value' is null or not an object

    Code:
    function validRequired(formField,fieldLabel)
    {
      var result = true;
      
      if (formField.value == "")
      {
    	alert('Please enter a value for the "' + fieldLabel +'" field.');
    	formField.focus();
    	result = false;
      }
      
      return result;
    }
    Here is an example of a call to the validRequired

    Code:
    function validateForm(theForm)
     {
       // Customize these calls for your form
     
       // Start ------->
     	if (!validRequired(theForm._firstName,"First Name"))
     	return false;

  2. #2
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make your question more clear. It doesnt make sense?
    the validation works great with no errors until all of the fields are valid the page still works fine
    What?!?!?

  3. #3
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use punctuation, and seperate your post out and explain a bit more.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •