function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
visulaforcevisulaforce 

how prompt a user to delete a record in VF

Hi,
I am facing a problem. I wanna prompt a msg to user before deleting a record. I am not able to use apex:commandLink for that cos it should be direct child of apex:form.  so i am using source code in bold  below to delete on apex:ouputLink. in docDeletePage i have written code below. on action init method is getting called n in this method i m deleting that particular record from third party API call. Code is not working and I m not sure this is the right way to do this. Pls suggest me is thre any other way. pls reply soon
 
 
Code:
<apex:page action="{!init}" standardController="Opportunity" extensions="DeleteDocument" tabStyle="Opportunity">
</apex:page>

 
  
 
 
Code:
<apex:page action="{!loginDocMall}" standardController="Opportunity" extensions="ViewDocumentControllerExt"  tabstyle="Opportunity">
<apex:variable var="oid" value="{!$CurrentPage.parameters.id}"/> 
<apex:form >
<apex:pageBlock title="Document">
<apex:pageblockTable value="{!propertyList}" rendered="{!NOT(ISNULL(propertyList))}" var="docProperty" columns="9">
<apex:column >    
    <apex:facet name="header">Action</apex:facet>
    <apex:outputLink value="{!urlFor($Page.docEditPage, null, [sessionid = sessionId, docid = docProperty.docId, oppid = oid])}">Edit</apex:outputLink>&nbsp;
    <apex:outputLink action="return confirmDelete()" value="{!urlFor($Page.docDeletePage, null, [sessionid = sessionId, docid = docProperty.docId, oppid = oid])}">Del</apex:outputLink>&nbsp;
</apex:column>
..................
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 
Code for DeleteDocument
public class DeleteDocument {

    public DeleteDocument(ApexPages.StandardController controller) {

    }
    
    public PageReference init()
    {
        code for delete a record
        ..................

        PageReference pageRef = page form which i called docDeletePage;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',oppId);
        //pageRef.getParameters().put('sessionId',sessionId);
        return pageRef;
    }

}