Skip to main content
Participant
June 5, 2007
Question

Delete Button

  • June 5, 2007
  • 2 replies
  • 598 views
I have a page that has delete buttons on every row. I am having trouble getting the row to delete.

Here is the code on my table data include file:
<input type="Submit" name="btnDelete" value="Delete" class="Deletebutton" onmouseover="this.style.cursor='hand'" style="width: 75;" onClick="return confirm('Do you really want to delete?');">

Here is the code on my main page
<cfif isdefined("btnDelete")>
<cfquery name="qDeleteRecord" datasource="#session.datasource_name#">
DELETE FROM Table
WHERE UniqueColumn='#UniqueColumn#'
</cfquery>
<cfset Message="Record Deleted...">

RESULTS:

qDeleteRecord (Datasource=DS, Time=0ms, Records=0) in C:\Inetpub\wwwroot\Test.cfm

DELETE FROM Table
WHERE Column Name=''

Form Fields:
BTNDELETE=Delete
Column Name=



    This topic has been closed for replies.

    2 replies

    Participating Frequently
    June 6, 2007
    Use dynamic generation of the button onClick and a function to perform the form submit.

    <script>
    function delete(formobj,recordID){
    document.getElementById('target_id').value = recordID;
    formobj.form.submit();
    }
    </script>
    ------
    <input type="hidden" name="target_id" id="target_id" value="">
    <cfoutput query="qryData">
    <input type="button" value="delete" onClick="delete(this,#qryData.record_id#)">
    </cfoutput>
    Inspiring
    June 5, 2007
    I don't see any code that actually submits the form. Nor do I see any code
    that passes the UniqueColumn info.

    --
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    ------------------------------------------------------------------
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/



    "sundeviltennis" <webforumsuser@macromedia.com> wrote in message
    news:f44beh$c78$1@forums.macromedia.com...
    >I have a page that has delete buttons on every row. I am having trouble
    > getting the row to delete.
    >
    > Here is the code on my table data include file:
    > <input type="Submit" name="btnDelete" value="Delete" class="Deletebutton"
    > onmouseover="this.style.cursor='hand'" style="width: 75;" onClick="return
    > confirm('Do you really want to delete?');">
    >
    > Here is the code on my main page
    > <cfif isdefined("btnDelete")>
    > <cfquery name="qDeleteRecord" datasource="#session.datasource_name#">
    > DELETE FROM Table
    > WHERE UniqueColumn='#UniqueColumn#'
    > </cfquery>
    > <cfset Message="Record Deleted...">
    >
    > RESULTS:
    >
    > qDeleteRecord (Datasource=DS, Time=0ms, Records=0) in
    > C:\Inetpub\wwwroot\Test.cfm
    >
    > DELETE FROM Table
    > WHERE Column Name=''
    >
    > Form Fields:
    > BTNDELETE=Delete
    > Column Name=
    >
    >
    >
    >
    >