Skip to main content
Known Participant
October 5, 2010
Question

Image button in a cfwindow doesn't pass coordinates

  • October 5, 2010
  • 1 reply
  • 858 views

Normally when you click on an image button inside a CFFORM, the coordinates are  passed to the form processor. This is a simple way to support multiple buttons  from a single form because you can use the presence of a coordinate to tell you  which button was pressed.

I couldn't figure out why this wasn't working inside a CFWINDOW and eventually I  stripped out all the extraneous code until I discovered that when the CFFORM is  inside a CFWINDOW, it no longer passes the coordinates. Is that documented? Can  anyone comment on that situation?

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 5, 2010

    Could you pls post your test case so we're all reading from the same page, as it were?

    Cheers.

    --

    Adam

    jpullamAuthor
    Known Participant
    October 5, 2010

    OK, here is it is (other than the 2 images) ...

    Calling page is

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    </head>
    <body>
    <p><a href="javascript:ColdFusion.Window.show('EventUpdate');ColdFusion.navigate('TestImageButton2.cfm','EventUpdate');" >
    Click here to open the window</a></p>

    <cfwindow name="EventUpdate" modal="true" resizable="false" title="Test"
        width="550" height="550" x="500" y="150"
        bodyStyle="font-size:12px; font-family: verdana; background-color: ##dcefd2; color: black; text-align: left;"
        headerStyle="font-size:13px; font-weight:bold; font-family:Verdana; color: white; text-align:left;" >
        <cfajaximport tags="cfform, cfwindow" scriptsrc="/CFIDE/scripts">
        </cfwindow>

    </body>
    </html>

    Called Ajax processor:

    <cfdump var="#FORM#">

    <cfform>
        <cfinput name="Comment" size="75" required="no" />
        <INPUT TYPE="IMAGE" NAME="Save" SRC="MSave.png">
        <INPUT TYPE="IMAGE" NAME="Delete" SRC="MDelete.png">
        </cfform>

    Just click on the image and see what comes through. When similar code was run without the CFWINDOW, it provided the coordinates.

    Inspiring
    October 7, 2010

    Yeah, I ran your code and - unsurprisingly - saw the same thing you did.

    When one runs just TestImageButton2.cfm, <cfform> intercepts the form submit, running this event handler first: return _CF_checkCFForm_1(this).  However that one works.  When it's in a <cfwindow>, it runs this instead: return ColdFusion.Ajax.checkForm(this, _CF_checkCFForm_1,'EventUpdate_body') which seems bung to me.  WhyTF they mess with the form fields is beyond me.

    I'd raise a bug for this, and see if there's some way of doing what you want with JQuery or something similar instead.

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html

    Sorry to not be able to be of any more help than that :-(

    --

    Adam