Results 1 to 5 of 5

Thread: Using a image as a submit button

  1. #1
    Join Date
    Nov 2004
    Posts
    24

    Default Using a image as a submit button

    Hello,

    Is there another way then this:

    Code:
    <A href="javascript:document.myForm._eventId_proceed.name='_eventId_proceed';document.myForm.submit();">
      <img src="<%=response.encodeURL(request.getContextPath()+ "/static/img/btn_next.gif")%>" class="right" alt="Next" />
    </A>
    <input type="hidden" name="_eventId_proceed" value="transition">
    to use a image as a submit button?
    Last edited by mkamer; Aug 10th, 2009 at 07:12 AM.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    Please use [ code][/code ] tags when posting code.

    To answer your question, use a button or input element with type image.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Nov 2004
    Posts
    24

    Default

    Hi Marten,

    Thanks for answering.

    The use of html button i know. The problem is that if I use an image with href surrounded then the form will not be submitted and the value will not bind to my model object.

    The code that I mentioned contains a peace of javascript as a workarround. I was wondering if there is another (easier) way to accomplish a form submission in combination with webflow and an image as a button.

    It really looks trivial but I can't find a nice solution.

    Regards,

    Marc

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    As I stated use a button. The button will submit a form and you can put a img tag inside there... No need for the href...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Nov 2004
    Posts
    24

    Default

    Okay Marten...Thanks...

    I'll try that! I'm not able to test it at the moment. As soon as my server is up and running again i'll test it.

Tags for this Thread

Posting Permissions

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