I would like to have a query output of a database, then have a cffileupload window pop up, base on the person they select. I can get the first window to pop up from the query but when I select the next one it has the same information as the first. I can only get one pop up to work right. What am I doing wrong, here is my code?
Did you mean to pass the #order_id# to the other page? Also, a "submit" button doesn't make much sense here. Use a regular button (not submit) and show the window onClick:
<!--- sample query for testing ---><cfset orderSKU = queryNew("")><cfset queryAddColumn(orderSKU, "order_ID", listToArray("AAA,BBB,CCC"))><!--- only do import once ---><cfajaximport tags="cfwindow,cffileupload,cfform" ><cfoutput query="ordersku"><!--- form name should be unique ---><cfform id="test#currentRow#" name="test"> <cfinput name="imageField" type="button" value="#order_id#" class="member_button" onClick="ColdFusion.Window.create ('Window#order_id#', 'Add Photos', 'upload.cfm?id=#order_id#', {height:350, width:500, modal:true, closable:true, draggable:true, resizable:true, center:true, initshow:true, minheight:200, minwidth:200 })"> </cfform><br /></td> </tr></table></cfoutput>
I would like the fileuploader to know where the file should go, so I was trying to pass the #order_id#. I dont know If that is right or not, I have not that far with my code to even test
> "but when I select the next one it has the same information as the first..."
Did the code above fix the problem? When I run it (passing #order_id# to "upload.cfm") it changes every time. ie It's working as I'd expect. If not, can you elaborate on how it's behaving in correctly?
0
Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Yeah, I get the same result. The ajax controls don't always play well with each other. I think the issue here is related to using a flash control inside what's basically a div (not a real popup window).
I'm heading to sleep now, but I think you'll have to create a single window in the main page - outside the loop. Then do a hide/show instead of create(). This example is ugly but works w/cf10.
Edit Fixed example so it refreshes based on id.
<!--- sample query for testing ---><cfset orderSKU = queryNew("")><cfset queryAddColumn(orderSKU, "order_ID", listToArray("11,22,33"))><!--- only do import once ---><cfajaximport tags="cfwindow,cffileupload,cfform" ><script type="text/javascript"> function showOrderWindow(id) { ColdFusion.navigate('upload.cfm?id='+ id , "OrderWindow"); ColdFusion.Window.show('OrderWindow'); }</script><cfoutput query="ordersku"> <!--- form name should be unique ---> <cfform id="test#currentRow#" name="test"> <cfinput name="imageField" type="button" value="#order_id#" class="member_button" onClick="showOrderWindow(#order_id#)"> </cfform></cfoutput> <cfwindow name="OrderWindow" title="Add Photos" source="upload.cfm?id=" height=350 width=500 modal=true closable=true draggable=true resizable=true center=true y=100 initshow=false minheight=200 minwidth=200 /><br />
Hm... wait a sec. I'm seeing the same result under CF10, unless I remove the source="upload.cfm" from the cfwindow. Then it seems to pass the "ID" on the first click. Can you try it? See if it works for you too?
testPage.cfm
<!--- sample query for testing ---><cfset orderSKU = queryNew("")><cfset queryAddColumn(orderSKU, "order_ID", listToArray("11,22,33"))><!--- only do import once ---><cfajaximport tags="cfwindow,cffileupload,cfform" ><script type="text/javascript"> function showOrderWindow(id) { ColdFusion.navigate('upload.cfm?id='+ id , "OrderWindow"); ColdFusion.Window.show('OrderWindow'); }</script><cfoutput query="ordersku"> <!--- form name should be unique ---> <cfform id="test#currentRow#" name="test"> <cfinput name="imageField" type="button" value="#order_id#" class="member_button" onClick="showOrderWindow(#order_id#)"> </cfform></cfoutput> <cfwindow name="OrderWindow" title="Add Photos" source="upload.cfm" height=350 width=500 modal=true closable=true draggable=true resizable=true center=true y=100 initshow=false minheight=200 minwidth=200 /><br />
Im still getting the error on the first click, but any other works. What did you mean when you said
>" unless I remove the source="upload.cfm" from the cfwindow"?
In the Dump, I can see the ID being passed on the second click.
The test "upload.cfm" page doesn't show "ID" as a URL parameter on the 1st click. ie It's undefined like in your error. But when I omit "source", like in the later example, URL.ID is always defined and the error goes away.
0
overcolorAuthor Commented:
Ok, I got that also, let me try to make this work
0
overcolorAuthor Commented:
Im getting this error if I click the link on the page early.
Error replacing HTML, element not found: OrderWindow [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
Will the page have to completely load all the query information before any of them will work?
Not the query. The cfwindow would need to finish loading though. I can't reproduce that error w/the test page. But it sounds like the error is saying the window element doesn't exist yet. So when you call ColdFusion.navigate you get an error. But I can't be sure without seeing a screen short or the exact error message.
Maybe try putting the <cfwindow> code before any other elements. Also verify it exists first before calling ColdFusion.navigate
0
overcolorAuthor Commented:
I moved it above the query output and it works...thank you
Did you mean to pass the #order_id# to the other page? Also, a "submit" button doesn't make much sense here. Use a regular button (not submit) and show the window onClick:
Open in new window