• jim@celestialcrm.com
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi All,

    i wrote vf page for events.like this

public class eventsearch

{

public boolean cat{set;get;}

list<event> elist=new list<event>();

event e=new event();

public event getdates()

{

return e;

}

public void findevents()

{
cat=true;

if(e.startdate__c!==null)

{

date d=e.startdate__c;

for(event e:[select startdate__c from event where startdate__C>=:d])

{

elist.add(e);}
}

}

public list<event> getvalues()

{

return elist;

}

}

 

page like this:

 

<apex:page sidebar="false" controller="eventsearch"> 

<apex:form >

  <apex:inputfield value="{!dates.startdate__c}"/> 

<apex:commandButton action="{!findevents}" value="find"/> 

<apex:outputPanel rendered="{!cat}"> 

<apex:pageBlock > 

<apex:pageblocktable value="{!values}" var="ee"> 

<apex:column headerValue="from" value="{!ee.startdate__c}"/> 

</apex:pageblocktable> 

</apex:pageBlock> 

</apex:outputPanel> 

</apex:form>

</apex:page>

In the above code input field is displayed in vf page.but not visible in salesforce sites. But i did all CRUD and Field level security permissions for guest user. any one can u please help me.

 

Thanks in advance.

 

anu.....

  • September 07, 2011
  • Like
  • 0

Hi All, 

  i develop a page for event object search functionality. in that fo searching events based on from date and to date.For that we need to enter the dates like From:---------------

   To:-------------.these field are visible in vf page. but not visible in sites.But i did all CRUD settings and field level security settings.whats wrong in my code.I hope. any  one can resolve my problem.

 

 

 

My site url is:      https://sravani-developer-edition.ap1.force.com/Eventpage 

 

 

 

Page is:  

 

<apex:page Controller="eventpage"  sidebar="false">  <apex:form ><apex:pageBlock title="Search for an event">Location:<apex:inputText value="{!location}"/><br/>Category:<apex:inputText value="{!Category}"/><br/><br/><b>Daterange:</b><br/><br/>From:<apex:inputField value="{!dates.startdate__c}"/><br/>To: <apex:inputField value="{!dates.enddate__c}"/><br/><br/>
<apex:commandButton value="Find Events" action="{!findevents}"/><apex:outputPanel rendered="{!cat}">  <apex:pageBlock >  <apex:pageBlockTable value="{!events}" var="acc">  <apex:column headerValue="Event name" value="{!acc.Whoid}"/>  <apex:column headerValue="Location" value="{!acc.Location}"/>  <apex:column headerValue="FromDate" value="{!acc.startdate__c}"/>  <apex:column headerValue="ToDate" value="{!acc.enddate__c}"/>  <apex:column headerValue="Category" value="{!acc.Category__c}"/></apex:pageBlockTable></apex:pageBlock>  </apex:outputPanel>      </apex:pageBlock>     </apex:form>     </apex:page>

 

 

controller is:

 

public class eventpage{public string fromdate1{set;get;}public string location{set;get;}public string category{set;get;}public boolean cat{set;get;}event edate=new event();
public void setedate(event ed){edate=ed;
}public event getedate(){return edate;}public list<Event> elist=new list<Event>();
public void findevents(){elist.clear();if(location!=''&& category==''&& edate.startdate__c==null && edate.enddate__c==null){string s=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where location like:s]) { elist.add(e); system.debug('+++++++'+elist); }}else if(category!=''&&location==''&& edate.startdate__c==null && edate.enddate__c==null){string s1=category+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where category__C like:s1]) { elist.add(e);  }}else if(location!=''&&category!=''&& edate.startdate__c==null && edate.enddate__c==null){string s=location+'%';string s1=category+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where category__C like:s1 and Location like:s]) { elist.add(e);  }}else if(location==''&&category=='' && edate.startdate__c!=null && edate.enddate__c!=null  ){Date s2=edate.startdate__c;Date s3=edate.enddate__c;
for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2 AND enddate__c<=:s3]) { elist.add(e); System.debug('++++++++======'+elist);  }}

else if(location==''&&category=='' && edate.startdate__c!=null && edate.enddate__c==null  ){Date s2=edate.startdate__c;
for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2 ]) { elist.add(e); System.debug('++++++++======'+elist);  }}
else if(location==''&&category=='' && edate.startdate__c==null && edate.enddate__c!=null  ){
Date s3=edate.enddate__c;
for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where enddate__c <=:s3 ]) { elist.add(e); System.debug('++++++++======'+elist);  }}

else if(edate.startdate__c!=null && edate.enddate__c!=null&&location!=''&&category==''){Date s2=edate.startdate__c;Date s3=edate.enddate__c;String s4=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2 AND enddate__c<=:s3 AND location like:s4]) { elist.add(e);  }}else if(edate.startdate__c!=null && edate.enddate__c==null&&location!=''&&category==''){Date s2=edate.startdate__c;//Date s3=edate.enddate__c;String s4=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2  AND location like:s4]) { elist.add(e);  }}else if(edate.startdate__c==null && edate.enddate__c!=null&&location!=''&&category==''){//Date s2=edate.startdate__c;Date s3=edate.enddate__c;String s4=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where  enddate__c<=:s3 AND location like:s4]) { elist.add(e);  }}


else if(edate.startdate__c!=null && edate.enddate__c!=null&&location==''&&category!=''){Date s2=edate.startdate__c;Date s3=edate.enddate__c;
String s4=category+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2 AND enddate__c<=:s3 AND category__c like:s4]) { elist.add(e);  }}else if(edate.startdate__c!=null && edate.enddate__c==null&&location==''&&category!=''){Date s2=edate.startdate__c;//Date s3=edate.enddate__c;
String s4=category+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2  AND category__c like:s4]) { elist.add(e);  }}else if(edate.startdate__c==null && edate.enddate__c!=null&&location==''&&category!=''){//Date s2=edate.startdate__c;Date s3=edate.enddate__c;
String s4=category+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where  enddate__c<=:s3 AND category__c like:s4]) { elist.add(e);  }}



elseif(edate.startdate__c!=null &&edate.enddate__c!=null&&location!=''&&category!=''){Date s2=edate.startdate__c;Date s3=edate.enddate__c;
String s4=category+'%';String s5=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2 AND enddate__c<=:s3 AND category__c like:s4 AND location like:s5]) { elist.add(e);  }}
elseif(edate.startdate__c!=null &&edate.enddate__c==null&&location!=''&&category!=''){Date s2=edate.startdate__c;//Date s3=edate.enddate__c;
String s4=category+'%';String s5=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where startdate__c >=:s2  AND category__c like:s4 AND location like:s5]) { elist.add(e);  }}

elseif(edate.startdate__c==null &&edate.enddate__c!=null&&location!=''&&category!=''){//Date s2=edate.startdate__c;Date s3=edate.enddate__c;
String s4=category+'%';String s5=location+'%';for(event e:[select id,whoid,startdate__c,enddate__c,Location,Category__C from Event where  enddate__c<=:s3 AND category__c like:s4 AND location like:s5]) { elist.add(e);  }}
}public list<event> getevents(){cat=true;return elist;}public event getdates(){event e=new event();return e;}}

 

Thanks in advance.

anu...

  • September 07, 2011
  • Like
  • 0