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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Please help me with this script.. Thanks :)

    Hi I have found a script I would like to make a few changes to.. I have tried a few tricks but got me no-where.

    If you could help me I will be very much appreciated!
    Code:
    <HEAD>
    <script language="javascript">
    <!--
    //These are the names of the people you don't want
    
    //To add a person, just put their name in quotation marks
    //and add a comma after
    Names = new Array(
    "test1@email.com",
    "test2@email.com",
    "test3@email.com",
    "test4@email.com",
    "test5@email.com")
    function Check() {
     //Change FORM and FIELD to the form name and field name throughout this function
     namechk=document.FORM.FIELD.value.toLowerCase()
     awdrgy = 0
     aLeRt = 0
     while (awdrgy<=Names.length-1 && aLeRt!=1) {
      if (namechk==Names[awdrgy]) {
       aLeRt = 1
       alert("Either your account is suspended or you entered an invalid email address! Please try again.")
       document.FORM.FIELD.value=""
      }
      awdrgy++
     }
    }
    -->
    </script>
    
    </HEAD>
    
    <BODY>
    <form name="FORM">
    <input name="FIELD" onblur="Check();" onblur>
    <input type="button" onclick=storytest() value="Submit" class="form">
    </form>
    
    <!-- Script Size:  2.01 KB -->
    Basically What I want to happen is..

    If a email entered that is listed in the reject list they will get an alert. (This currently does this)

    If a email was entered that's not listed it will submit the form. (Currently does not do this)

    I am making a login form that is complete but I wanted to add the above code to it..

    If you or anyone could make it work the way I explained above I will be very much appreciated.

    Thanks,

    Chris
    Last edited by Kor; 12-14-2009 at 09:32 AM.

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    This has nothing to do with either JSON or DOM, so it would be better placed elsewhere. A moderator can move it for you.

    This code isn't intended to actually be used in production anywhere is it? It shouldn't be.

    The form won't submit because you've not defined an action. Check out this page for some elementary information on HTML forms.
    Are you a Help Vampire?

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Moved in main Javascript Forum.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,982
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
    The <!-- and //--> comment (hiding) tags have not been necessary since IE3. If you see these in some published script it is a warning that you are looking at ancient and perhaps (as here) unreliable code.

    This is easily circumvented if JavaScript is disabled. JavaScript form validation only provides convenience for users, not security. This means that JavaScript should be used as an "enhancement", not as a requirement. So your form should not be dependent on JavaScript alone to perform your validation. Instead, whatever server-side language you use to process the form (PERL, ASP, PHP, etc.) should also perform the same validation. Otherwise, people will be able to bypass your validation (and even possibly inject malicious code) simply by disabling JavaScript.

    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.


  •  

    Posting Permissions

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