I am building a custom list item edit form using SharePoint Designer.
I need the item to be deleted when user clicks "Cancel" button (same functionality as he would press "Delete" in ribbon).
I couldn't find too much information about it, so I tried to copy the code of "Delete" button in ribbon and replace the "Cancel" button with it, but it doesn't work...
Any suggestions? Anything helps.
UPDATE:
Code of the "Delete" button in the ribbon:
<a class="ms-cui-ctl-large" id="Ribbon.ListForm.Edit.Actions.DeleteItem-Large" onclick="return false;" href="javascript:;" mscui:controltype="Button" aria-describedby="Ribbon.ListForm.Edit.Actions.DeleteItem_ToolTip" role="button" unselectable="on">
<span class="ms-cui-ctl-largeIconContainer" unselectable="on">
<span class=" ms-cui-img-32by32 ms-cui-img-cont-float ms-cui-imageDisabled" unselectable="on">
<img class="" style="top: -341px;left: -511px;" unselectable="on" src="/_layouts/15/1033/images/formatmap32x32.png?rev=43">
</span>
</span>
<span class="ms-cui-ctl-largelabel" unselectable="on">
Delete<br>Item
</span>
</a>
Code of the "Cancel" button:
<input type="button" name="ctl00$ctl40$g_f25929d1_2f2f_439b_b216_92762649c491$gobackbutton2$ctl00$diidIOGoBack" value="Cancel" onclick="setTimeout(function(){window.frameElement.cancelPopUp();}, 0); return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl40$g_f25929d1_2f2f_439b_b216_92762649c491$gobackbutton2$ctl00$diidIOGoBack", "", true, "", "", false, true))" id="ctl00_ctl40_g_f25929d1_2f2f_439b_b216_92762649c491_gobackbutton2_ctl00_diidIOGoBack" accesskey="C" class="ms-ButtonHeightWidth" target="_self">
Basically, I'm hiding the whole ribbon row and want to have "Delete" button at the bottom of the form instead of "Cancel". But If I just copy the code, it doesn't work...