0

I am very new in salesforce and i am trying to create a custom buttons depending on how many data i retrieve from the object field. For Example in my apex controller function get_bttns() will retrieve {edit_record,delete_record} , The Visualforce page will display the following buttons (edit_record button and delete_record button).

HERE IS MY SAMPLE CODE

APEX CONTROLLER

public class Example_CTRL {

    public static List<Button_List__c> bttns()
    {
        return [Select Id,actions__c FROM Button_List__c];
    }

}

VISUALFORCE

<apex:page controller="Example_CTRL">

    <apex:form>
    dont know what to do here
    </apex:form>

</apex:page>
0

For that purpose you can use apex:repeat and generate buttons

<apex:page standardController="Example_CTRL">
<apex:form>
    <apex:pageBlock title="My Content" mode="edit">
        <apex:pageBlockButtons>
         <apex:repeat value="{!Button_List}" var="btn">
          <apex:commandbutton id="{!btn.id}" value="{!btn.value}" action="{!btn.action__c}"/>
</apex:repeat>
        </apex:pageBlockButtons>

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.