Skip to main content
Inspiring
December 15, 2008
Question

I am in Middle of CFC

  • December 15, 2008
  • 1 reply
  • 843 views
I implement my ajax Delete functionality and it works fine within a grid.

it delete the records.

But i have a image related to the delete functionality. whenever i run that function my image do not get deleted.

how can i change the code to make it work:

here is my code:

function deleteTheme() {
var proxyp = new DeleteThe();
proxyp.setErrorHandler(errorHandler);
proxyp.setCallbackHandler(DeleteCallback);

var dID = ColdFusion.getElementValue('Grid01','Form1','ID');
proxyp.DeleteThe(dID);
<cfajaxproxy cfc="cfc.cfc1" jsclassname="DeleteThe">

this code runs the cfc function which delete the joke.

i tried adding the functionality like in a cfc in different function

<cfif fileexists('imagefile')>
<cffile action=delete" file="path">
</cfif>

but it did not worked out
This topic has been closed for replies.

1 reply

Inspiring
December 16, 2008
you will need to code the delete file process into your DeleteThe
function in your cfc.
you are passing some id to your function -> query the db to get the
filename associated with that id -> delete the file if it exists ->
delete the record from your db

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
December 16, 2008
I am using ID of theme table to delete the file, how do i point to the file so i can write in the detail in cfc:

i thought of a n example as:

<cffunction access="remote" name="DeleteListedTheme" verifyclient="yes" returntype="void" output="no">
<cfargument name="themeID" required="yes" default="" type="numeric">
<cfset mydel = "">
<cfquery datasource="#request.dsn#" username="#request.user#" password="#request.pass#" name="mydel">
DELETE FROM
themes
WHERE
themeID = <cfqueryparam cfsqltype="cf_sql_numeric" value="#trim(arguments.themeID)#">
</cfquery>
<cfif filexists(where should i find the file based of ID)>
<cffile action=delete file="path to file">
</cfif>
</cffunction>

but it not working