I am using Visualforce to list out a few different opportunities a checkbox for each one. My goal is to select an opportunity by clicking the checkbox, then pressing a commandbutton to pass that opportunity info into apex. I am setting the value field of the checkbox to an opportunity object in my apex controller but it is trying to return a boolean instead of the opportunity object. Here is a snippet of my VF and Apex:
VF:
<apex:page standardController="System__c" extensions="SystemAddToOp" recordSetVar="system__c" >
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock title="Add These Systems to an Opportunity">
<apex:pageBlockButtons >
<apex:commandButton action="{!updateSystems}" value="Add Selected Systems to Opportunity" />
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!ops}" var="o">
<apex:column value="{!o.Name}"/>
<apex:column value="{!o.id}"/>
<apex:column value="{!o.CloseDate}"/>
<apex:column value="{!o.Amount}"/>
<apex:column headerValue="Select">
<apex:inputCheckbox value="{!selectedOp}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
APEX (snippet):
public Opportunity selectedOp{get;set;}
public PageReference updateSystems()
{
insert selectedOp;
system.debug(selectedOp);
return null;
}
Any guidance here would be much appreciated. Thanks!