You need to sign in to do that
Don't have an account?
[URGENT] Vfpage custom delete link - ConfirmationToken
Hi guys, I've created a link which enables the user to delete the specific stuff they want. In this case, it's Notes.
But when I click delete, I links me to a page which says:
The attempted delete was invalid for your session. Please confirm your delete.
What should I put in my codes to prevent this from happening?
<apex:page standardController="Handoff__c" showHeader="false" sidebar="false">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style>
.activeTab {background-color: #236FBD; color:white; background-image:none}
.inactiveTab {background-color: lightgrey; color:black; background-image:none}
.br {mso-data-placement:same-cell;}
</style>
</head>
<apex:tabPanel switchType="client" selectedTab="tabNotes" id="CustomObjectTabPanel" tabClass="activeTab" inactivetabClass="inactiveTab">
<apex:tab label="Notes" name="Notes" id="tabNotes">
<apex:form >
<apex:pageBlock title="Notes">
<apex:pageBlockTable value="{!Handoff__c.Notes}" var="note">
<apex:column value="{!note.body}" />
<apex:column HeaderValue="Edit"><a href="/{!LEFT(note.id,15)}/e?&retURL=%2Fapex%2FViewNA%3Fid%3D{!Handoff__c.Id}">Edit</a></apex:column>
<apex:column HeaderValue="Del"><a href="/setup/own/deleteredirect.jsp?delID={!LEFT(note.id,15)}&_CONFIRMATIONTOKEN" onclick="return confirm('Are you sure you want to delete this note?')">Del</a></apex:column>
</apex:pageBlockTable>
<apex:commandbutton value="Add Notes" action="/002/e?parent_id={!LEFT(Handoff__c.Id,15)}&retURL=%2Fapex%2FViewNA%3Fid%3D{!Handoff__c.Id}"/>
</apex:pageBlock>
</apex:form>
</apex:tab>
</apex:tabPanel>
</apex:page>
It is likely because of a combination of cross-domain authentication mixed with a bad case of weird HTML rendering caused by the method by which you are attempting to render this page.
Some suggestions:
What I'm trying to do here is delete the notes displayed in my custom vf page, not the whole record. I undersand that what I coded might not be the best practices, but other than that I'm not sure of how to produce the codes which I'm tasked to do.