function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shree KShree K 

How to display fieldset in another output panel after command buttons onclick event in the current outputpanel

Hi, 
i have a command button in one outputpanel,when user clicks on that button a fieldset has to be dispalyed in another outputpanel(even the outputpanel has to be displayed only after onclick of that button,
help will be appreciated,

Thanks
chhakri
 
pconpcon
What have you tried to do?  Can you provide the code that you have attempted that is not working? (Making a smaller reproducer would be the most helpful).

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Shree KShree K
Hi pcon ,sorry i had to post the question on mobile,so i was unable to add the code earlier,here is my code,

1) I am trying to create and Enable a command button called "Modify Another item" only for the 3rd and 4th picklist options 
    i.e("Class/Offering Modification" and "Course Modification request") from the "Request_Type__c"  picklist field  in the web form,  

2) After selecting either of those picklist values if user clicks the command button called "Modify Another item" after rendering, a fieldset called          "Modification_Type1" should be displayed and the button has to be enabled only two times.

Please see attached for the web form that i am working on, hope you would be getting a clear idea about what i am doing.
there you could the select option in the 1st field is "Class Offering Modification" ,i dont have the commandbutton yet,so when user selects that option and hits the commandbutton that i mentioned above.a filedset has to be dispalyed in the b ottom ,it could be just in pageblock or in another outputpanel.User-added image 

VF Page Code:
 
<legend id="testNote"  style="float: left; position: relative; font-size: small"><b style="color:red;">*</b>Any change of Request type will result in loss of previous selection.</legend><br/><br/>
<legend id="test"  style="float; position: relative;"><b style="color:red;">*</b>Request Type</legend><br/>
                         
 <apex:actionRegion >
 <apex:selectList label="Request Type" value="{!RequestValue}" size="1" multiselect="false">
<apex:actionSupport event="onchange"  action="{!requestTypeOnChange}" reRender="fieldSet,attachid,downloadId"/>
 <apex:actionstatus startText="Applying Values.............">                   
  </apex:actionstatus>
  <apex:selectOption itemLabel="" itemValue=""></apex:selectOption>
  <apex:selectOption itemLabel="Attestations" itemValue="Attestations"></apex:selectOption> 
<apex:selectOption itemLabel="Bulk Course Offering Modification" itemValue="Bulk_course_Offering_Modification"></apex:selectOption>
 <apex:selectOption itemLabel="Class/Offering Modification" itemValue="F_Class_Offering_Modification"></apex:selectOption>
<apex:selectOption itemLabel="Course Modification Request" itemValue="F_Course_Modification_Request"></apex:selectOption>
<apex:selectOption itemLabel="Other" itemValue="Other"></apex:selectOption>
<apex:selectOption itemLabel="Package Request" itemValue="Package_Request"></apex:selectOption> 
 </apex:selectList>
  </apex:actionRegion>
                          
                         
 <apex:outputPanel id="requesttypeinput">
 <apex:actionRegion >                    
  <apex:actionFunction action="{!saveRequest}" status="loading"  name="submitbutton" reRender="fieldspanelid,attachid,buttonspanelid" >
<apex:param value="" name="description"/>
 </apex:actionFunction>
 <apex:actionFunction action="{!shwattachmentpopup}" oncomplete="disablesavebuttons();"  name="showattachmodel" reRender="attachid,modelpopid" status="loading" > 
<apex:param value="" name="setpopdisplay"/>
</apex:actionFunction>
</apex:actionRegion>
</apex:outputPanel>

          </div>
       </div>                     
                    
 <apex:outputPanel id="fieldSet">
  <apex:repeat value="{!$ObjectType.Case_form_Extn__c.FieldSets[RequestValue]}" var="f"> 
                     <div class="row margin">
                        <div class="small-12 columns">
                           <legend> {!f.label}</legend>
                           <br/>
                            <apex:inputField value="{!ocaseformextn[f]}" required="true" />
                            
                            
                          <br/>
                        </div>
                      </div>
                    </apex:repeat>
                    </apex:outputPanel>
                    
                       <br/>

Controller Code:

Public without sharing class  TDR_Delivery1_Request_ctrl  extends SitesTodHeaderController
{

 
    /*Public Variables*/
    
    Public Case_form_Extn__c ocaseformextn {get;set;}
    Public List<Case_form_Extn__c> licaseformextn;// {get;set;}
    Public Map<string,Case_form_Extn__c> caseformmap;// {get;set;}
    Public Case Ocase; //{get;set;} 
    Public List<RecordType> OcaseRecordType;// {get;set;}
    public String recordType {get;set;}
    public String requesttype {get;set;}
    public String reqtype {get;set;}
   
    public List<RecordType> oCaseExtnrecordtypes {get; set;}
    public List<SelectOption> orecordtypes {get; set;}
    
    Case_form_Extn__c str;
    Public Document doc {get;set;}
    public List<String> docIdList = new List<string>();
  
    public boolean addAttachment{get; set;}
    public string setpopdisplay{get;set;}
    public List<Document> selectedDocumentList {get;set;}
    
    
    /* Error Message related variables */
    public boolean pageError {get; set;}
    public boolean showlist{get; set;}
    public boolean RenderFunction{get; set;}
    public boolean RenderFieldSetBlock{get; set;}
    public String pageErrorMessage {get; set;}
    public string formname{get;set;}
    Public Map<string,Id> caseformextrecordtypeMap{get;set;}
    
    
   
    
     public string RequestValue{get; set;}
     public List<AttachmentsWrapper> UploadedDocumentList {get; set; }
     public List<selectoption> requestTypeOptions {get;set;}
     Public boolean ShowModificationButton {get;set;}
    
     
     Public TDR_Delivery1_Request_ctrl (){
        
        requestTypeOptions = new List<selectoption>();
        requestTypeOptions.add(new selectoption('-None-','None'));
        requestTypeOptions.add(new selectoption('Attestations','Attestations'));
        requestTypeOptions.add(new selectoption('Bulk Course Offering Modification','Bulk_course_Offering_Modification'));
        requestTypeOptions.add(new selectoption('Class Offering Modification','F_Class_Offering_Modification'));
        requestTypeOptions.add(new selectoption('Course Modification Request','F_Course_Modification_Request'));
        requestTypeOptions.add(new selectoption('Other','Other'));   
        requestTypeOptions.add(new selectoption('Package Request','Package_Request'));   
        
        showAttachmentButton=false;
        ShowModificationButton= false;        
        }
        
        public PageReference requestTypeOnChange(){
            if(RequestValue =='Attestations' || RequestValue =='Bulk_course_Offering_Modification' || RequestValue =='Other' || RequestValue =='Package_Request' ) {
                showAttachmentButton  = true;
            }else{
                showAttachmentButton  = false;
            }
            
            return null;
        }
   
   
    public PageReference UpOnButtonClick(){
            if(RequestValue =='Class_Offering_Modification' || RequestValue =='Course_Modification_Request' ) {
                ShowModificationButton  = true;
            }else{
                ShowModificationButton  = false;
            }
            
            return null;
        }
   
   
   // Get record types for Delivery request forms and display in 'Request type'.
    
    
    Public void getfields(){
     
        if(String.IsNotEmpty(apexpages.currentpage().getparameters().get('Param1'))){
           RenderFieldSetBlock=true; 
           RenderFunction = false;
           requesttype = apexpages.currentpage().getparameters().get('Param1');
           formname=requesttype;
           requesttype = EncodingUtil.urlDecode(requesttype, 'UTF-8');
           ocaseformextn.TDR_Request_Type__c = requesttype ;   
           DlccategorySelection = '';
           system.debug('414214124' + requesttype);
           if(requesttype != 'None'){
               requesttype=requesttype.replace(' ','_').replace('(' , '').replace(')' , '').replace(',' , '_').replace('-' , '_').replace('/' , '_').replace('.' , '');
           }
           
           if(requesttype.length() > 41){
               
             requesttype = requesttype.substring(0,40);
             system.debug('@@@@@@@@@@@@' + requesttype );
             if(requesttype.endsWith('_')){
              requesttype= requesttype.removeEnd('_');
                              
             }
         }
       
       }
       
      }  
        
        
   // saverequest method is to save the request.
   
    Public PageReference saveRequest(){
              
     system.debug('----------------->');       
    try{
         pageError = false;
         pageErrorMessage = '';
                    
          
        // If there is no validation error save the request.
              
          if(pageError == false){  
            
              RecordType rectype = new RecordType();
         
             string recrdtname; 
             
            
            system.debug('##'+RequestValue);
             if( RequestValue=='Attestations')//referring fieldsets
             { 
                         ocaseformextn.RecordTypeId = System.Label.Attestations; //custom labels which has record typeIds in its value field
                   
             }  
             else
             if( RequestValue=='Bulk_course_Offering_Modification')
             {
                         ocaseformextn.RecordTypeId = System.Label.Bulk_Course_Offering; 
             
             }
             else
             if( RequestValue=='Class_Offering_Modification')
             {
                         ocaseformextn.RecordTypeId = System.Label.CL_Class_Offering_Modification; 
             
             }
             else  
             if( RequestValue=='Course_Modification_Request')
             {
                         ocaseformextn.RecordTypeId = System.Label.CL_Course_Modification_Request; 
             
             }
             else 
             if( RequestValue=='Other')
             {
                        ocaseformextn.RecordTypeId = System.Label.Other; 
                        fileUpload = true;
             }
             else
             if( RequestValue=='Package_Request')
             {
                         ocaseformextn.RecordTypeId = System.Label.Package_Request; 
             
             }
             
             
            
             
        //Insert Case
           try{
              Ocase = new case();
              Ocase.Status    = 'New';
              Ocase.Subject =  System.Label.TDR_Case_Subject;
              Ocase.WCT_Category__c =  System.Label.TDR_Case_Category;
              Ocase.Origin = System.Label.TDR_Case_Origin;
              Ocase.Description = apexpages.currentpage().getparameters().get('description') ;  
              Ocase.Contactid   = loggedInContact.id;
              
             
           // Insert Case Extension Form. 
             ocaseformextn.Case_Form_App__c = System.Label.Case_Form_App;
             ocaseformextn.TDR_Employee__c  = loggedInContact.id;
             ocaseformextn.GEN_Case__c= Ocase.Id;
             }
             
             
             
             system.debug('=========Case Extension=======' + ocaseformextn);
            
             Insert ocaseformextn;
             
             uploadRelatedAttachment();
              
             }catch(Exception e){
             return null;
             }
          }
       
                 else{
           return null;
          }
}
catch(Exception ex){
system.debug('------getMessage----'+ex.getMessage()+'--------getLineNumber--------'+ex.getLineNumber());
 return null;
         }
        
    }