troubleshooting Question

Coldfusion Delete button question

Avatar of roger v
roger vFlag for United States of America asked on
ColdFusion Language
3 Comments1 Solution954 ViewsLast Modified:
I have a CF 9 form that has add and update submit buttons. I display a bunch of rows from the database and I need the ability to delete each individual rows. My idea is to display a "delete" submit button for each row, name it dynamically with #currentrow#, and then when user clicks delete, ask for confirmation and if yes, then delete that row.

I have the javascript to do this but I'm not quite sure on how to handle this in the coldfusion form action section. Currently my action page looks like this:

<cfif IsDefined('form.btnSubmit')>
    <!---do a bunch of stuff--->
<cfelseif IsDefined('form.btnUpdate')>
   <!---do a bunch of updates--->
<!---this is where my delete code needs to go--->
<cfelseif IsDefined('form.btnDelete#currentrow#')>
  <!---delete query--->

<!---and my form page looks like this--->
<cfoutput query="myQuery">
       <!---this is where I need the delete button--->
            <input type="submit" name="btnDelete#myQuery.currentrow#" value="Delete" onclick="return validateForm(,this.form);">
            <input type="submit" name="btnSubmit" value="Save" onclick="return validateForm(,this.form);">
            <input type="submit" name="btnUpdate" value="Update" onclick="return validateForm(,this.form);">


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros