• Balaji B 10
  • NEWBIE
  • 54 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 13
    Questions
  • 4
    Replies
Can Any One Help Me...!!! I am New To salesforce.... for already Developed Apps......How to identify Which Custom objects are Salescloud & Which custom objects are Service cloud? ...Like BookMyshow,Dtdc Courier Etc..
Hi All,

My requirement is I have 2 radio buttons byname Movies,Events and When i click on movies related Movielist dropdown should appear similarly for events.I have a submit button byname ClickMe,if i click that button i want to display selected movie or an event.

I have done it partially,i need any of ur help as i am new to salesforce i am not exposed to these kind of scenarios.So please help me out.
I am sharing my code.Thanks in advance.


The dropdown in red box should come only if select any of above radio button.The text in yellow box should come only after Clicking Click Me button.
*********Vfpage******************

<apex:page id="pp" title="Movie's Now" controller="Movies" showHeader="false">
  <Apex:form >
   <apex:pageBlock title="Welcome to MOvie Selection Process">
   
   <!--   For Selecting Movie and Play        -->
      <apex:selectRadio value="{!s}" rendered="true">
        <apex:selectOptions value="{!items}"/>
      </apex:selectRadio><p/>
         <apex:actionSupport event="onclick" action="{!Click}" ReRender="in" >
            <apex:param assignTo="{!s}" name="ss" value="{!Movies}" />
         </apex:actionSupport>
           <!--<apex:actionFunction action="{!MovieSelection}"  name="MovieLocked" /> 
           <apex:actionFunction action="{!EventSelection}"  name="EventLocked" />-->
           
           <!-- for dropdown list -->
            <apex:selectList size="1" value="{!newmovies}" multiselect="false" rendered="{!newMovies!=null}" onclick="MovieSelection">
                <apex:selectOptions value="{!Movies1}"/>
                <apex:actionSupport event="onchange" reRender="in" action="{!MovieSelection}"/>
            </apex:selectList>
        
        
         <apex:selectList size="1" value="{!newEvents}" multiselect="false" rendered="{!newEvents!=null}">
            <apex:selectOptions value="{!Events1}"/>
        </apex:selectList>
        
        <!-- command button -->
        <apex:commandButton value="$$Click Me$$" action="{!Click}" rerender="out" status="status"/>
   </apex:pageBlock>
   
   
   <apex:outputpanel id="in" rendered="{!lmve.size != 0 && newEvents!=null || newmovies!=null}">
    
                              <apex:actionSupport event="onchange" rerender="out" status="status"/>
                          
   </apex:outputpanel>
   
   
   
   <apex:outputPanel id="out" rendered="{!lmve.size != 0}">
           <apex:outputText value="{!lmve}">The selected option is "{!s}"</apex:outputText>
           <apex:outputText value="{!lmve}">The selected Movie is "{!Events}"</apex:outputText>
          
     </apex:outputPanel> 
  </Apex:form>
</apex:page>
 
************Controller class**********************


public class Movies
{

  public String s{get;set;}
  public String name{get;set;}

  public boolean Movieflag{get;set;}
  public boolean Eventflag{get;set;}
  public  List<Movie__c> lmve{Get;Set;}
  public String Events{get;set;}
  public String Movies { get; set; }
  public boolean displayflag{get;set;}
  public List<SelectOption> options1{get;set;}
  public List<SelectOption> options2{get;set;}
  
  
  String[] newmovies= new String[]{};
  
  public String[] getnewmovies() {
            return newmovies;
        }
            
        public void setnewmovies(String[] newmovies) {
            this.newmovies= newmovies;
        }


  String[] newEvents=new String[]{};
  
  public String[] getnewEvents() {
            return newEvents;
        }
            
        public void setnewEvents(String[] newEvents) {
            this.newEvents= newEvents;
        }
  
  public Movies(){
   System.Debug('Helllo');
  }
  
  
  public PageReference Click()
  {
   Eventflag=false;
   if(s!=null && s.equalsIgnoreCase(Movies)){
    Movieflag=true;
   }
   
   else if(s!=null &&s.equalsIgnoreCase(Events)){
   Eventflag=true;
   }
   
   List<Movie__c> lmve=new List<Movie__c>();
   if(s!=null)
   lmve=[SELECT Id,Cinemas__c,name__c,Price__c,Tickets__c from Movie__c];
   
   return null;
  
  }
  
  
   public pagereference MovieSelection() 
    {
        Events=null;
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.confirm,'You Selected a movie'));
        return null;  
    }
    
    
    public pagereference EventSelection() 
    {
        Movies=null;
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.confirm,'You Selected an Event'));
        return null;  
    }
  

   public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('Movies','Movies'));
        options.add(new SelectOption('Events','Events')); 
        return options; 
    }
    
    public List<SelectOption> getMovies1() {
            List<SelectOption> options1 = new List<SelectOption>();
            options1.add(new SelectOption('Bahubali','Bahubali'));
            options1.add(new SelectOption('Rangitaranga','Rangitaranga'));
            options1.add(new SelectOption('BhaiJan','BhaiJan'));
            return options1;
        }
    public List<SelectOption> getEvents1() {
            List<SelectOption> options2 = new List<SelectOption>();
            options2.add(new SelectOption('abc','abc'));
            options2.add(new SelectOption('def','def'));
            options2.add(new SelectOption('sss','sss'));
            return options2;
        }
    

}