Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2003
    Location
    Barcelona
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A form validation

    Hi !,

    Somebody can help me? I have spent hours searching what is the mistake in a ‘.js’ file.
    I have two ‘.js’ files with a part of the validation of a form, named ‘Mail.js’ and ‘ZIP.js’, with the functions named ‘checkMail’ and ‘checkZIP’ respectively. Then I have a ‘.js’ file behind of these, named ‘allForm.js’, that trigger both validations. This ‘allForm.js’ file that trigger the two ‘.js’ validations is as follows:

    AllForm.js

    function valForm1() {

    if (!checkMail()) {
    return false;
    }
    if (!checkZIP()) {
    return false;
    }
    return true;
    }

    The code of the web page:

    <head>
    <script src="Validations/form1/allForm.js">
    </script>

    <title>……

    …..
    <form name="form1_new" onSubmit="return valForm1()" action="……


    The ‘Mail.js’ and ‘ZIP.js’ validations runs, but not the ‘allForm.js’. The error that the browser returns when I try to trigger the ‘allForm.js’ is : An object was expected. I can’t understand what is wrong !!

    I have already checked all the ‘returns’ ‘false’ and ‘true’ of the ‘Mail.js’ and ‘ZIP.js’ functions.


    Thanks,
    Cesar

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    you most likely need to add

    <script src="Validations/form1/Mail.js">
    </script>
    <script src="Validations/form1/Zip.js">
    </script>

    to your html page

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Nov 2003
    Location
    Barcelona
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    You are right !

    Thank you Alien51,
    Cesar


  •  

    Posting Permissions

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