Skip to main content
Inspiring
Feb 6, 2013 8:09 PM UTC
Question

Using multiple images as submit buttons

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 is closed to new replies. Start a new post to keep the conversation going.

    5 replies

    Legend
    Feb 7, 2013 6:00 PM UTC

    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.

    Translate
    Inspiring
    Feb 6, 2013 8:18 PM UTC

    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.

    Translate
    weezerboyAuthor
    Inspiring
    Feb 7, 2013 4:08 PM UTC

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

    Translate
    Inspiring
    Feb 7, 2013 5:28 PM UTC

    That won't solve the problem.

    Translate
    WolfShade
    Legend
    Feb 6, 2013 8:10 PM UTC

    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")>

    ^_^

    Translate