SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2001
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML 1 Strict, Form w/Multiple Submit Buttons, image for buttons, problem!

    Hello,

    Here is what I am trying to do; I need to build a page that has several form elements on it and several submit buttons.

    For example, think of a list of data, each item on the list has a checkbox (input form element) next to it. Then there would be two submit buttons, one could be "view" and the other could be "edit".

    "View" would show you more details of the selected checkboxes, and "Edit" would allow you to see those details but edit them instead. So you would basically be branching to two different actions (inside the page the form is posting to) based on which submit button was pressed.

    Now this xhtml worked:
    Code:
    <form action="post.cfm" method="get" id="theForm">
    <div>
    
    <table>
       <tr>
          <td><input type="submit" name="Function" value="View" /></td>
          <td><input type="submit" name="Function" value="Edit" /></td>
       </tr>
       <tr>
          <td><input type="checkbox" name="chbx" value="1" />One</td>
          <td><input type="checkbox" name="chbx" value="2" />Two</td>      
       </tr>
    </table>
    
    </div>         
    </form>
    The next page receives the following URL parameters:
    post.cfm?Function=View&chbx=1

    I can do an if statement based on the value of the name of the Submit button group, "Function". Which for the above URL parameter is "View".

    - But -

    I want to make the submit buttons images, not just the standard form elements. I tried to use the following code in place of the two submit button inputs:
    Code:
          <td><input type="image" name="Function" value="View" src="view.gif" /></td>
          <td><input type="image" name="Function" value="Edit" src="edit.gif" /></td>

    Which displays two nice images instead of the buttons. And in Mozilla (Netscape 7), everything works the same as the first example of code above. Although the page receiving the post has a wierd URL parameter list:
    post.cfm?Function.x=16&Function.y=16&Function=View&chbx=2

    But in IE and Opera, the URL parameter list is slightly different:
    /post.cfm?chbx=1&Function.x=14&Function.y=7

    Notice the lack of "Function=View"?

    So therefore, the next page does not work, because it does not receive the proper variable, "Function".

    Does anyone know of a way I can make the form buttons look like images, but still act like real submit buttons.

    I need a solution with Zero JavaScript, and a solution that is not based on a browser feature, but actually something that is a standards based solution.

    If anyone has any ideas, guesses, suggestions, etc... Please speak up!!!

    Thanks,
    michael.
    __________________________
    http://www.michaelsica.com

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Where do function.x and function.y come from?

    I can come up with a JavaScript-based solution for you, but it's not really what you want.

    For your two checkboxes, I see that they have the same name and different values; should they be radio buttons instead?

    Let me know what you come up with, and if you need the JavaScript-based solution let me know.

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2001
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Vinnie, but I am trying to stay as far away from JavaScript as possible.

    They are check boxes because you can select multiple ones. (I should have given them different names, but that isn't causing the problem.)

    I really have no idea where the function.x and function.y come from. I can only assume it is because the buttons are now images, maybe it is the X/Y coordinates for the pixels that I click on for the images....

    Anyone else know how to tackle this issue?

    Thanks,
    michael.
    __________________________
    http://www.michaelsica.com

  4. #4
    SitePoint Member
    Join Date
    Jun 2004
    Location
    Baltimore
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trying to fdind the same thing

    Hi Michael-

    I am trying to find a way to do the same thing without javascript. I have been looking everywhere and trying multiple codes and still haven't come up with an answer. I can't wait to see the results!

    Dana


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
  •