You need to sign in to do that
Don't have an account?
Help me out please
when i insert dates in 2 fields,it should display all the records/names created between that dates. but what have given the query ,it is accepting that dates, manually if i enter in date fields its not accepting, i know something error in query,it would be great if anyone help in this issue?
<apex:page controller="MyController1">
<apex:form >
<apex:pageBlock title="Date Fields">
<apex:pageBlockSection >
<apex:inputText value="{!acc1.dj__c}"/>
<apex:inputText value="{!acc1.releaving_date__c}"/>
<apex:commandButton action="{!go}" value="go" immediate="false"/>
<apex:dataList value="{!acc}" var="acc1" >
{!acc1.name}
</apex:dataList>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
////////////////////////////////controller////////////////////
public class MyController1
{
public Task DateInput {get;set;}
public LIST<hods__c> acc{get; set;}
public hods__c acc1{get; set;}
public MyController1()
{
DateInput = new Task();
acc = new LIST<hods__c>();
acc1 = new hods__c();
}
public void go()
{
acc=[Select name from hods__c where dj__c = LAST_N_YEARS:2 and releaving_date__c <= TODAY ];
system.debug('11111111111111111'+ acc);
}
}
You should use inputfield inplace of inputtext that should bring the calender as well as should give you date in proper format which is acceptable by the query.
use it
<apex:inputField value="{!acc1.releaving_date__c}"/>