You need to sign in to do that
Don't have an account?
Passing parameter from visual force page into a controller method to populate a custom field
<apex:sectionHeader title="Supported Contracts" />
<apex:pageBlock id="thePageBlock">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Back to Case" action="{!backToCase}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!SupContract}" var="c">
<apex:column >
<apex:commandButton action="{!addSupportContract}" value="Select"/>
<apex:param assignTo="{!supportedConId}" value="{!c.Id}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Contract_Ref_No</apex:facet>
<apex:commandLink rerender="detail">
{!c.Contract_Ref_No__c}
<apex:param name="conid" value="{!c.Id}"/>
</apex:commandLink>
</apex:column>
<apex:column >
<apex:facet name="header">Start Date</apex:facet>
<apex:outputField value="{!c.StartDate}"/>
</apex:column>
The section of the controller looks like this:
public void addSupportContract ()
{
selectedConID = System.currentPageReference().getParameters().get('supportedConId');
System.debug (' *****Contract ref from page ' + selectedConID);
c.Contract_Ref_No__c = selectedConId;
}
Thanks
Try using this:
<apex:param name="supportedConId" value="{!c.Id}"/>