Copy link to clipboard
Copied
I have master / detail page set. From the detail set there are links to delete or update a record. When I click the link to delete the record, it goes to the confirmation page with the correct record. Now, when I add the delete record server behavior and a submit button, this is what happens. As soon as I click the link to go to the delete confirm page, the record deletes and the page redirects to the page I put in the server behavior. It doesn't show the confirm page and doesn't wait for me to hit the confirm button. The page runs and successfully deletes the page from the DB.
How do I get it to wait until I hit the submit button?
You need to surround your delete query with an "If" statement that checks for a confirmation variable of some sort, then when the user clicks the confirmation link you can pass the necessary variable and the ID of the record the delete query is expecting.
As an alternative you could use a JS alert fuction to ask the user if they are sure they want to delete the record and then allwo the delet to run after confirmation. To do this you could use code like this...
<input type="submit" name="DELETE" v
...Copy link to clipboard
Copied
You need to surround your delete query with an "If" statement that checks for a confirmation variable of some sort, then when the user clicks the confirmation link you can pass the necessary variable and the ID of the record the delete query is expecting.
As an alternative you could use a JS alert fuction to ask the user if they are sure they want to delete the record and then allwo the delet to run after confirmation. To do this you could use code like this...
<input type="submit" name="DELETE" value="DELETE"
onclick="return confirm('Are you SURE you want to DELETE this record?')">
--
Lawrence *Adobe Community Expert*
www.Cartweaver.com
Complete Shopping Cart Application for
Dreamweaver, available in ASP, PHP and CF
www.twitter.com/LawrenceCramer
Find more inspiration, events, and resources on the new Adobe Community
Explore Now