I have a VF page that uses a custom controller.
The page is a summary page with multiple objects on the page, each one has a check box, that when checked, and saved will not display the object anymore.
I have commandLink action to a method in my controller.
public PageReference doChecks() { return null; }
If I could get the names of the checked boxed in my apex controller, I could save the data.
Here's my VF page:
<apex:page showHeader="false" sidebar="false" title="Warrany Case Info" controller="WarCase_controller">
<apex:pageBlock title="Cases Summary" tabStyle="Account">
<apex:form >
<apex:commandLink action="{!doChecks}" value="Hide Checked items"/>
<table style="border-bottom:1px solid black;paddinf-bottom:20px" width="100%"><tr>
<td style="border-right:1px solid black;padding-right:20px" valign="top">
<font size="3em">New Cases (Created in the last 7 days)</font><br/>
<apex:dataTable value="{!newCases}" var="case" id="theTable1" width="100%" >
<apex:column >
<input type="checkbox" name="CH-New-{!case.ID}"/>
<apex:inputField value="{!case.summaryNewHide__c}"/>
<apex:outputLink value="/{!case.ID}" target="_top" style="padding-right:5px">{!case.Account.Name} ({!case.Owner_Name__c})</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">Short Desc </apex:facet>
<apex:outputText value="{!case.Short_Desc__c}"/>
</apex:column>
</apex:dataTable>
</td>
<td style="padding-left:20px" valign="top">
<font size="3em">Closed Cases (Closed in the last 7 days)</font><br/>
<apex:dataTable value="{!closedCases}" var="case" id="theTable2" width="100%">
<apex:column >
<input type="checkbox" name="CH-Closed-{!case.ID}"/>
<apex:facet name="header">Account Name (Owner Name) </apex:facet>
<apex:outputLink value="/{!case.ID}" target="_top" style="padding-right:5px">{!case.Account.Name} ({!case.Owner_Name__c})</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">Short Desc</apex:facet>
<apex:outputText value="{!case.Short_Desc__c}"/>
</apex:column>
</apex:dataTable>
</td>
</tr></table>
<br/>
<font size="3em">Upcoming Scheduled Tasks (Scheduled for the next 7 days)</font><br/>
<apex:dataTable value="{!tasks}" var="task" id="theTable" width="100%" >
<apex:column >
<input type="checkbox" name="CH-Task-{!task.ID}"/>
<apex:facet name="header">Account Name (Owner Name) </apex:facet>
<apex:outputLink value="/{!task.ID}" target="_top" style="padding-right:5px">{!task.case__r.Account.Name} ({!task.case__r.Owner_Name__c})</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">Short Desc </apex:facet>
<apex:outputText value="{!task.case__r.Short_Desc__c}" style="padding-right:5px"/>
</apex:column>
<apex:column >
<apex:facet name="header">Task Description </apex:facet>
<apex:outputText value="{!task.Description__c}" style="padding-right:5px"/>
</apex:column>
<apex:column >
<apex:facet name="header">Scheduled Date</apex:facet>
<apex:outputText value="{0,date,MM-dd-yyyy}">
<apex:param value="{!task.Schedule_Date__c}"/>
</apex:outputText>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:pageBlock>
And my controller:
public with sharing class WarCase_controller {
public List<Case> getNewCases(){
Date tempDate = Date.today();
tempDate = tempDate.addDays(-7);
List<Case> caseList=[
Select Account.Name, Description, Owner_Name__c, Short_Desc__c, ID
From Case where ownerId=:Userinfo.getUserId() and TitanClosedDate__c=null and TitanCreatedDate__c>:tempDate and summaryNewHide__c=false ];
return caseList;
}
public List<Case> getClosedCases(){
Date tempDate = Date.today();
tempDate = tempDate.addDays(-7);
List<Case> caseList=[
Select Account.Name, Description, Owner_Name__c, Short_Desc__c, ID
From Case where ownerId=:Userinfo.getUserId() and TitanClosedDate__c>:tempDate and summaryCloseHide__c=false];
return caseList;
}
public List<Warranty_Task__c> getTasks(){
Date tempDate = Date.today();
tempDate = tempDate.addDays(7);
List<Warranty_Task__c> caseList=[
Select case__r.Account.Name, case__r.Owner_Name__c, case__r.Short_Desc__c, Description__c, Schedule_Date__c, ID
From Warranty_Task__c where case__r.ownerId=:Userinfo.getUserId() and Schedule_Date__c<:tempDate and summaryHide__c=false];
return caseList;
}
public PageReference doChecks() {
return null;
}
}