48 users online (1 members and 47 guests)  


  Results 1 to 8 of 8

Related

  1. CSS Buttons and the Submit    Forum: CSS Forum
    Replies: 5
  2. Multiple Submit buttons    Forum: HTML Forum
    Replies: 3
  3. Replies: 1
  4. Replies: 0
  5. Single Page, Multiple Backgrounds?    Forum: Website Scripts Forum
    Replies: 6
  1. #1
    RonB.'s Avatar
    New User

    Status
    Offline
    Join Date
    May 2002
    Location
    Near Chicago
    Posts
    8

    multiple submit buttons in single form

    If one has multiple submit buttons inside a single form tag, how do you identify which button was pressed.

  2. #2
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    That all depends on what you are trying to do..

    What is it that your trying to do?

  3. #3
    RonB.'s Avatar
    New User

    Status
    Offline
    Join Date
    May 2002
    Location
    Near Chicago
    Posts
    8
    It's kinda hard to explain.

    First I tried to use a button and jump to a new page, but the data that was entered was not carried with it.

    Because I have a second drop down box whose values are dependant on a first drop down box, I did this for the first select; <select name="Client" size="1" onChange="forms[0].submit()"> This resubmits the same page but now loads the second drop down box with different info.

    Within the same form I now need to put submit box to jump to an update routine, but because of the dependant select boxes the form just resubmits the same page.

    Is there some value that is loaded when a button is pressed. I pretty for sure you can name a submit button, can that help me in some way?

  4. #4
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    Wow.. you lost me there..

    I know nothing about JS.. only PHP/MySQL and ASP ;(

    Sorry I can't help with this one

  5. #5
    RonB.'s Avatar
    New User

    Status
    Offline
    Join Date
    May 2002
    Location
    Near Chicago
    Posts
    8
    After much digging through HTML help sites and a little bit of testing I discovered this.

    <input type=submit value="Enter Hours" name="Submit">

    In the above statement, when the button is pressed, the values for name and value automatically get passed along with the rest of the form data. So that the variable Submit has the value of Enter Hours.

  6. #6
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    the question you asked us and the answer you gave us seam very different...

  7. #7
    RonB.'s Avatar
    New User

    Status
    Offline
    Join Date
    May 2002
    Location
    Near Chicago
    Posts
    8
    Forgive my lingo, I'm new to this, so I know what I mean, just not sure what the right terms are.

    <form method=POST action="main?Comp=$(Comp)>
    <input type=submit value="Enter Hours" name="Submit">
    <input type=submit value="Delete Hours" name="Submit">
    </form>

    Above is an example of where there are multiple submit buttons within a single form. When the page "main" is executed, along with any form data that is passed, the name of the button and it value are passed also. The variable $(Submit) can now be tested. It will contain the value "Enter Hours" or Delete Hours" depending on which button was pressed.

  8. #8
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    I got what you were trying to do after you gave the answer, but on your first question mywild guess of what you were talking about was way off... but o well.



Tags for this Thread