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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    please help with this script

    i got this script, but i am a javascript newbie, here is the problem, when i do as what is instructed, i put my other parts into the form , then i click submit, they only check the validation, they dont submit my form, please help
    Code:
    <!-- TWO STEPS TO INSTALL VALIDATION (CHARACTER):
    
      1.  Copy the coding into the HEAD of your HTML document
      2.  Add the last code into the BODY of your HTML document  -->
    
    <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original:  Mikhail Esteves (miks80@yahoo.com) -->
    <!-- Web Site:  http://www.freebox.com/jackol -->
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
    function dodacheck(val) {
    var strPass = val.value;
    var strLength = strPass.length;
    var lchar = val.value.charAt((strLength) - 1);
    if(lchar.search(mikExp) != -1) {
    var tst = val.value.substring(0, (strLength) - 1);
    val.value = tst;
       }
    }
    function doanothercheck(form) {
    if(form.value.length < 1) {
    alert("Please enter something.");
    return false;
    }
    if(form.value.search(mikExp) == -1) {
    alert("Correct Input");
    return false;
    }
    else {
    alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
    form.select();
    form.focus();
    return false;
    }
    alert("Correct Input");
    return false;
    }
    //  End -->
    </script>
    
    </HEAD>
    
    <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
    
    <BODY>
    
    <form name=xyz onSubmit="return doanothercheck(this.txtTerm);">
    <input type="text" name="txtTerm" size="35" maxlength="50" value="" onKeyUp="javascript:dodacheck(xyz.txtTerm);">
    <br>
    <input type=submit value=Check>
    </form>
    flying dagger

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    alert("Correct Input");
    return false; // should be: return true;


  •  

    Posting Permissions

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