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

Thread: Buttons

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

    Buttons

    Hi all

    i have a page where there are some fields that is needed to be filled in before sending back to server(im using Java programmin here).

    And i do have some validation(Using JavaScript) so to check that all fields are needed to be filled in(at least not blank) before submit.

    So here's the problem. when clicking the "Submit" button, Fields that are not filled will be alert. This is good , but, i do have another button which is "Back".. This "Back" button can be using anytime in that page(to previous page), whether the fields are filled or not. But, whenever i clicked on this button, validation alerts is alarmed.

    How do i make these 2 buttons coordinate? they have to be in the same form..

    Help urgently needed.. Thx all
    if someone lives for a lifetime in happiness, he then would not know the true happiness.

  • #2
    New Coder
    Join Date
    Mar 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi JaiL...

    I don't understand why your validation scripts would be called when the "back" button is pressed.


    The validation scripts should only be fired by the onSubmit event.
    The "back" button should have it's own function.
    It makes no sense that the "back" button would fire the onSubmit function (unless you wired it that way )

    Maybe you need to show the code.

    k

  • #3
    New Coder
    Join Date
    Jan 2003
    Location
    Singapore
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi khaki,

    this is a rough idea hows my codes are
    _____________________________________________________
    <form name=form method=get value=servlet/abc onSubmit="return validation()">
    //here are all the fields



    <input type = button name = submit name = "Submit">
    <input type = button name = back name = "Back">

    </form>

    ______________________________________________________

    is there anything wrong with this..?
    im still a js newbie..
    10x for advicing..
    if someone lives for a lifetime in happiness, he then would not know the true happiness.

  • #4
    New Coder
    Join Date
    Mar 2003
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okay JaiL...
    here's the problem:

    this:
    <input type = button name = submit name = "Submit">

    should be this:
    <input type="submit" value="Submit">

    This will designate the submit button as... well... the submit button.
    k

    EDIT: Plus, I think that you are looking to "post" (not "get") and unless you have some kind of script that needs the "value" of the form, it's not required.
    Last edited by khaki; 03-31-2003 at 05:10 AM.


  •  

    Posting Permissions

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