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 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2003
    Location
    Singapore
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb I dont want it to refresh

    ok, here's the problem.

    i'd created a form, and tried some validation(checking of empty fields) on it and the validation will execute when the submit button is pressed.

    When one or some of the fields is/are empty, JS will alert the user to input all fields.

    HOWever, the broswer will refresh itself after the user clicked 'ok'.
    N thus, all the input fields have to be entered again!! This is wrong n troublesome.

    i need help that can provide me the codes or any website that illusarated this problem.

    Bless the person who helps me(rookie)..
    if someone lives for a lifetime in happiness, he then would not know the true happiness.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you provide a link to your code or past the code here? We need to see your code to help you.

  • #3
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do you have the event onsubmit in your <form> ?

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #4
    New Coder
    Join Date
    Jan 2003
    Location
    Singapore
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanx for replying

    Im not using the onSubmit 'function', imstead, im using onClick.


    this is part of my codes

    ******************************
    //This will call from a .js file.
    function Validation(offset)
    {
    alert("validation");
    if (validateDate(offset)&&checkIfEmpty(offset))
    {
    document.offset.submit;
    }
    }
    .....
    //Start of form.
    <form name="offset" method="POST">

    .... // all in put types/fields

    //End of form.
    <INPUT name="offset" type=submit value=Submit onClick="return Validation(this.form)"> </form>

    *************************************************
    If u guys need more info from me, plz kindly reply, i will post more of my codes up...

    Thanx a million, guys....
    if someone lives for a lifetime in happiness, he then would not know the true happiness.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using onsubmit instead, and doing this:
    Code:
    if (validateDate(offset)&&checkIfEmpty(offset)) { 
       return true;
    } 
    else {
       return false;
    }
    I think you might benefit by reading this tutorial.
    Last edited by whammy; 01-21-2003 at 01:30 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Geez, that was awful quick... I just posted my message about 3 or 4 minutes ago!
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    New Coder
    Join Date
    Jan 2003
    Location
    Singapore
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thank you.

    Thanks a lot, guys..

    It works!!!!!!!!!!!!!

    thank you.
    if someone lives for a lifetime in happiness, he then would not know the true happiness.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow, somehow my reply got posted before the message. That's strange!
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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