• EfratD
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hello experts!

 

I am trying to use a standard command link functionality in my VF page but for some reason the controller function is not being called (I know this by putting debug messages).

 

Can you help me spot my rookie's mistake?

 

Page:

 

<apex:page standardController="My_Request__c" action="{!doSometing}"  extensions="My_Request_View_Override" title="My Request" showHeader="true" id="myPageID" cache="false">

 

<apex:form id="myFormID"  >

 

<apex:pageBlock title="Request Products">

 

    <apex:pageBlockTable value="{!My_Request__c.Products__r}" var="product">

 

        <apex:column headerValue="Action">

 

<apex:commandLink action="{!delProd}" onClick="return window.confirm('Are you sure?');"  rendered="{!My_Request__c.Stage__c = 'Draft'}" id="clDelId" value="Del">
                <apex:param value="{!product.Id}" name="pid" />
            </apex:commandLink>

 

</apex:column> 

</apex:pageBlockTable>
   
 </apex:pageBlock>
     
</apex:form>

 

</apex:page>

 

 

Controller function:

 

public PageReference delProd(){
   

    try{
        if(ApexPages.currentPage().getParameters().get('pid') != ''){
        if (productID != null){
            ID productID = ApexPages.currentPage().getParameters().get('pid');
            List<Product__c> n = [select id from Product__c where Id =: productID ];
            if(n.size() > 0){
                delete n;
            }
        }
    }catch(DmlException e){
       
        }
    }
   
    return new Pagereference('/'+record.Id);
}

 

Thanks a bunch!!!

 

Hello experts!

 

I am trying to use a standard command link functionality in my VF page but for some reason the controller function is not being called (I know this by putting debug messages).

 

Can you help me spot my rookie's mistake?

 

Page:

 

<apex:page standardController="My_Request__c" action="{!doSometing}"  extensions="My_Request_View_Override" title="My Request" showHeader="true" id="myPageID" cache="false">

 

<apex:form id="myFormID"  >

 

<apex:pageBlock title="Request Products">

 

    <apex:pageBlockTable value="{!My_Request__c.Products__r}" var="product">

 

        <apex:column headerValue="Action">

 

<apex:commandLink action="{!delProd}" onClick="return window.confirm('Are you sure?');"  rendered="{!My_Request__c.Stage__c = 'Draft'}" id="clDelId" value="Del">
                <apex:param value="{!product.Id}" name="pid" />
            </apex:commandLink>

 

</apex:column> 

</apex:pageBlockTable>
   
 </apex:pageBlock>
     
</apex:form>

 

</apex:page>

 

 

Controller function:

 

public PageReference delProd(){
   

    try{
        if(ApexPages.currentPage().getParameters().get('pid') != ''){
        if (productID != null){
            ID productID = ApexPages.currentPage().getParameters().get('pid');
            List<Product__c> n = [select id from Product__c where Id =: productID ];
            if(n.size() > 0){
                delete n;
            }
        }
    }catch(DmlException e){
       
        }
    }
   
    return new Pagereference('/'+record.Id);
}

 

Thanks a bunch!!!