Skip to main content
Inspiring
February 6, 2013
Question

Using multiple images as submit buttons

  • February 6, 2013
  • 3 replies
  • 947 views

I have this form with 2 images as submit buttons

  • <INPUT TYPE="image" SRC="assets/images/lgstart_b.png" ALT="Submit Form" name="time_in">
  • <INPUT TYPE="image" SRC="assets/images/lgstop_bo.png"   ALT="Submit Form" name="time_out">

The problem is I can tget the next page to acknowldge either button. I am using CF9

Here is the form2.cfm page

<cfif IsDefined("FORM.time_in.X")>

TIME IN

<cfelseif IsDefined("FORM.time_out.X")>

TIME OUT

<cfelse >

Nothing

</cfif>

I get an 'undefined' message only

I know I have done this before what am I missing?

Here is the form with the  2 images as submit buttons

<form action="form2.cfm" method="post"> 

         <table cellpadding="0" cellspacing="5">

            <tr>

             

              <td align="center" class="crewlist_time"><strong>Status</strong></td>

            

            </tr>

            <cfoutput query="get_employees">

              <tr>

                <td width="20" align="left"><input type="checkbox"  checked name="Employee_ID" value="#Employee_ID#"/></td>

                <td class="crewlist_cell"> #EMPLOYEE_NAME# </td>

                

               <div class="clock">

            <div class="clockin">Clock In</div>

        <INPUT TYPE="image" SRC="assets/images/lgstart_b.png"   ALT="Submit Form" name="time_in">

        </div>

          <div class="clockrt">

            <div class="clockin">Clock Out</div>

              <INPUT TYPE="image" SRC="assets/images/lgstop_bo.png"   ALT="Submit Form" name="time_out">

             </div>

        </div></cfoutput>

        <br>

        <br>

        </form>

    This topic has been closed for replies.

    3 replies

    Legend
    February 7, 2013

    I think the issue is that you neew a value parameter in the input tag, not just the name. But then I never use multiple submit buttons like this because of the issue Dan mentioned -- keyboard and "default" button if the user presses enter. If possible, I would recommend a plain button (as opposed to a submit) or an anchor tag.

    Inspiring
    February 6, 2013

    I'm sure those two images look very nice but if someone submits the form with their keyboard, normal html behaviour by the way, things might not work as well as you had hoped.

    weezerboyAuthor
    Inspiring
    February 7, 2013

    Well the images didnt look that nice and I've switched to regular submit buttons styled with CSS 3.

    Inspiring
    February 7, 2013

    That won't solve the problem.

    WolfShade
    Legend
    February 6, 2013

    I think FORM.time_in.X is only for IE.  I don't think any other browser will see .X.

    Try <cfif StructKeyExists(form,"time_in")>

    ^_^