I have been working on this for a few weeks now so any assistance would be wonderful. I am trying to create a report with a VF page to pull information from some custom objects and their associated custom objects. I figured out how to show all the information that I need but am having issues actually filtering the data(SOQL statement) based on a date range that the user would input at the top of the screen. I got the date input fields to show up at the top with the nice calendar view and everything but am having issues with the few items below. I am new to APEX and SOQL but am not new to coding so would appreciate examples. My code is below the questions. Thanks again for your help!
Need to pass the input data fields, start and finish, from the VF page to the controller extension to be used in a SOQL query for filtering the data.
Need to have the dates that are inputted kept in the fields at the top so the user can see what dates it is filtering off of.
VF PAGE:
<apex:page standardController="Case__c" extensions="CasesandSubjectsController">
<script>
function toggleContacts(className){
elem = document.getElementsByClassName(className)[0];
if(elem.style.display == 'none')
elem.style.display = 'block';
else
elem.style.display = 'none';
}
</script>
<apex:form >
<apex:panelGrid columns="5" id="dates1">
<b>Start Date: </b><apex:inputfield value="{!taskRec.ActivityDateTime_del__c}"/>
<b>End Date: </b><apex:inputfield value="{!taskRec1.ActivityDateTime_del__c}"/>
<apex:commandButton value="Submit" rerender="dates1"/>
</apex:panelGrid>
<apex:outputPanel id="test">
<apex:repeat value="{!ca}" var="c" id="case">
<apex:pageBlock title="{!c.Case_Name__c} ({!c.LastModifiedDate})">
<apex:pageBlockButtons location="top">
<input type="button" onclick="toggleContacts('tbl-{!c.id}');" value="Show Notes/Attachments" class="btn" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="3">
<Apex:outputLabel value="Case ID: " for="caseid">
<apex:outputLink id="caseid" value="/{!c.id}">{!c.name}</apex:outputLink>
</Apex:outputLabel>
<Apex:outputLabel value="Action Taken: ">{!c.Action_Taken__c}</Apex:outputLabel>
<Apex:outputLabel value="Case Type: ">{!c.Sec_Case_Type__c}</Apex:outputLabel>
</apex:pageBlockSection>
<apex:pageblockSection columns="2">
<Apex:outputLabel value="Summary: ">{!c.Sec_Summary__c}</Apex:outputLabel>
</apex:pageblockSection>
<apex:pageBlockTable value="{!c.Subject_for_Cases__r}" var="subs" id="sub">
<apex:facet name="header">Subjects</apex:facet>
<apex:column headerValue="Name">
<apex:outputLink value="/{!subs.Subject_Name__r.Id}">{!subs.Subject_Name__r.name}</apex:outputLink>
</apex:column>
<apex:column value="{!subs.Subject_Name__r.Subject_Type__c}"/>
</apex:pageBlockTable>
<apex:outputPanel styleClass="tbl-{!c.id}" style="display:none;">
<apex:pageBlockTable value="{!c.Notes__r}" var="n" id="note">
<apex:facet name="header">Notes</apex:facet>
<apex:column value="{!n.LastModifiedDate}"/>
<apex:column value="{!n.name}"/>
<apex:column value="{!n.Body__c}"/>
</apex:pageBlockTable>
<apex:pageblockTable value="{!c.Attachments}" var="a" id="attach">
<apex:facet name="header">Attachments</apex:facet>
<apex:column value="{!a.createddate}"/>
<apex:column headerValue="Link to File">
<apex:outputLink value="/servlet/servlet.FileDownload?file={!a.Id}">View File</apex:outputLink>
</apex:column>
<apex:column value="{!a.name}"/>
</apex:pageblockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:repeat>
</apex:outputPanel>
</apex:form>
</apex:page>
CONTROLLER EXTENSION
public class CasesandSubjectsController{
public task taskRec{get; set;}
public task taskRec1{get; set;}
Public CasesandSubjectsController(){
taskRec= new task (ActivityDateTime_del__c = null);
taskRec1= new task (ActivityDateTime_del__c = null);
}
public CasesandSubjectsController(ApexPages.StandardController controller){
ca = [SELECT Id, Name, Action_Taken__c, LastModifiedDate, Case_Name__c, Case_Status__c, Sec_Case_Type__c, Sec_Summary__c, Report_StartDate__c, Report_EndDate__c,
(SELECT Subject_Name__r.Id, Subject_Name__r.name, Subject_Name__r.Subject_Type__c FROM Subject_for_Cases__r),
(SELECT name, Body__c, LastModifiedDate FROM Notes__r),
(SELECT createddate, Id, name FROM Attachments)
FROM Case__c
Where Case_Status__c = 'Active'];
}
public List<Case__c>ca{get; set;}
}