cfmessagebox
I am trying to use cfmessage box to confirm prior to deleting a record. I have a delete button that I am diplaying the fessage box using onclick. The problem I am having is the cfmessagebox pop's up, but the record gets deleted anyway and the cfmessagebox goes away. Basically, the form is getting submitted regardless. I am thinking I am doing something wrong here, but can someone point me in the right direction. Below is come code snippets:
cfmessagebox code:
<cfmessagebox type="confirm" name="confirmdelete" title="Delete Employee?"
message="Are you sure you want to delete this employee?"
buttonType="YesNo" icon="warning" labelYes="Yes" labelNo="No">
Button code:
<button type="submit" id="delete_button" name="delete_button" onClick="javascript:ColdFusion.MessageBox.show('confirmdelete');">Delete</button>
I am pretty sure I should change the button type to "button" rather than submit. Then, use calbackhandler to submit the form. However, once the form is submitted, I check for which button is pressed using:
<cfif isDefined("form.delete_button")>
I need to submit the form using javascript, then make sure, after the form is submitted, to make sure the above if statement is true.
Any ideas on what I am doing wrong? Or, any better ways to do this?
