If you don't mind the page refreshing, there's no need to use JS.

Here's a basic page:

<cfif IsDefined("FORM.id")>
        <cfquery name="" datasource="#APPLICATION.DSN#">
                DELETE FROM yourTable
                WHERE id = <cfqueryparam cfsqltype="CF_SQL_INTEGER" 
value="#FORM.id#">
        </cfquery>
</cfif>

<cfquery name="yourQuery" datasource="#APPLICATION.DSN#">
        SELECT * FROM yourTable
</cfquery>

<cfoutput>

<cfloop query="yourQuery">
        <form action="#CGI.SCRIPT_NAME#" method="post">
                <input type="hidden" name="id" value="#yourQuery.id#" />
                <div>
                        #yourQuery.aColumn#
                        <input type="submit" value="Delete" />
                </div>
        </form>
</cfloop>

</cfoutput>

On first loading you'll see your data with a delete button. Click delete and
the form will post back to itself and delete the row you clicked on.

There are loads of things you can do differently with something like this
but this is about as basic as it gets.

Adrian
http://www.adrianlynch.co.uk/


-----Original Message-----
From: Vishal . [mailto:[EMAIL PROTECTED]
Sent: 19 May 2008 16:20
To: CF-Talk
Subject: a query

There is a page which will display data from a table. I have to add a
delete button in the page so that after clicking on that delete button
then it should refresh page and delete that data from the page and also
delete that data from the table....

I can use javascript and coldfusion.

Can u please help me in this????


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305624
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to