SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Submit button value different to text on button

    Hello,

    I was wanting some advice for the best way I can achieve this. I have a form, with multiple submit buttons. Each submit button is supposed to do something different, though I would like them to actually say the same thing.

    For example


    Item 1 [Edit] [Delete]
    Item 2 [Edit] [Delete]
    Item 3 [Edit] [Delete]

    I would like [Edit] and [Delete] to be buttons, but all in the same form.

    The problem with <input type="submit"> is that the value must be the same as the text on the button. This means that you can't have different values when the text on the button is the same.

    What do you think would be the best way to do this?

    I'm hesitant to use separate <form> elements for every row, but if it comes to it I could do it.

    I'm hesitant to use <button> instead of <input type="submit"> because some browsers (earlier browsers) do not support it.

    Is there a way to do something like this with <input>?
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  2. #2
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I dont think its possible without passing the data through the URL. Which is possible using Javascript.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Couldn't you just parse the name value in the script that receives the form rather than the value.

    http://ppewww.ph.gla.ac.uk/~flavell/www/trysub.html
    Your form script then has to make its selection on the basis of the "name" returned, not on the "value", since the values are all the same.
    Paul


Bookmarks

Posting Permissions

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