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
salesforcemicky125salesforcemicky125 

how to display a pageblocksection on clicking a button in visualforcepage

Hi ,

I have a visual force page  and an  controller .

We have a Button in my VF page called Continue ...>

when i click on this button i want to display below pageblock  " Select Email Template Folder " and " Select Email Template".

Currently i am viewing te VF Page with  pageblock  " Select Email Template Folder " and " Select Email Template" with out clicking the Contionue.

This my VF Page can any one help me out

<apex:page standardController="Event_Registration__c" extensions="MassEmailEvent" id="pageid" sidebar="true" showHeader="true" tabStyle="Contact">

<style>
.mmSubheader {
background-color= #E2E3E5;
font size: 1em;
margin: 18px 0 7px;
padding: 4px 9px;
color: black;
font-weight:bold;
}
.label{
padding:3px;
color: #222222;font-family: Arial,Helvetica,sans-serif;
}
.he1 {

     font-weight: bold;
     -moz-user-select: text;
    font-family: 'Arial','Helvetica',sans-serif;
    font-size: 100%;
    line-height: normal;
    border-style: none solid none none;
    border-width: 0 1px 0 0;
    padding: 2px 0 3px;
    vertical-align: baseline;
     border-left-color: #EEEEEE;
    border-right-color: #D0D0D0;
    border-left: 1px solid;
    border-right: 1px solid;
    -moz-user-focus: normal;
    outline: medium none;
    text-align: left;
}
</style>
<script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                   
            for(var i=0; i<inputElem.length; i++)
            {           
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                      
                    inputElem[i].checked = cb.checked;
                }
            }
        }
</script>
<script language="javascript" type="text/javascript">
var pickListArray=[];
var campaignPickListArray=[];
function popUpLookUpWindow(url,col,val) {
      var colValue=document.getElementById(col).value;
      if(colValue!='None'){
      url=url+'&column='+colValue+'&val='+val;
    newwindow=window.open(url,'name','height=430,width=620,toolbar=no,resizable=yes,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
    }
}
function closePopUp(){
   if (null!=newwindow)
    {
      newwindow.close();
    }
}
</script>
  <apex:form >
<apex:repeat value="{!pickListCol}" var="request">
        <script>
            pickListArray.push('{!request}');
        </script>
    </apex:repeat>
     <apex:repeat value="{!pickListCampaignCol}" var="list">
        <script>
            campaignPickListArray.push('{!list}');
        </script>
    </apex:repeat>
    <script>
   
function isPickList(selectedId,lookupId){

var val=document.getElementById(selectedId).value;
for (var i = 0; i < pickListArray.length; i++) {
// alert('pickListArray === ' + pickListArray[i]);
        if (pickListArray[i] ===val){
            document.getElementById(lookupId).style.display = "block";
            break;
            }else{
            document.getElementById(lookupId).style.display = "none";
            }
    }
}

function isCampaignPickList(selectedId,lookupId){
var val=document.getElementById(selectedId).value;
for (var i = 0; i < campaignPickListArray.length; i++) {
  // alert('campaignPickListArray=== ' + campaignPickListArray[i]);
        if (campaignPickListArray[i] ===val){
            document.getElementById(lookupId).style.display = "block";
            break;
            }else{
            document.getElementById(lookupId).style.display = "none";
            }
    }

}
  </script> <apex:sectionHeader subtitle="Mass Email"/>
<apex:pageBlock title="Step 1: Select email recipients">
<div class="mmSubheader">Select Event Name <apex:inputField value="{!eropty.Recruiting_Event__c}" id="crmcmpid">
  </apex:inputfield>
  
  <br></br>
  Attended <apex:inputField value="{!eropty.Attended__c}" id="crmcmpid1">
  </apex:inputfield>
  Attending <apex:inputField value="{!eropty.Attending__c}" id="crmcmpid2">
  </apex:inputfield>
Invited <apex:inputField value="{!eropty.Invited__c}" id="crmcmpid3">
  </apex:inputfield>
No Show <apex:inputField value="{!eropty.No_Show__c}" id="crmcmpid5">
  </apex:inputfield>
Not Attending <apex:inputField value="{!eropty.Not_Attending__c}" id="crmcmpid6">
  </apex:inputfield>
No Responce<apex:inputField value="{!eropty.Not_Attending__c}" id="crmcmpid7">
  </apex:inputfield>
 
  <br></br>
 
 
 
 

</div> 

      <div class="mmSubheader" style="display:none">Choose Member Type to Search          </div>   
<div class="mmSubheader"></div>
 
    <apex:outputPanel id="criteria">
          <apex:actionstatus id="status" startText="Loading...">
             <apex:facet name="stop">
           
               <apex:outputPanel >
              
            
            <apex:commandButton action="{!go}" value="Search" reRender="searchProgress,results1,dTable" status="searchProgress" />
            <br/>
            <apex:actionStatus id="searchProgress">
                        <apex:facet name="start">
                            <table align="center" border="0">
                                <tr>
                                    <td style="vertical-align:middle;" align="center">
                                        <img src="{!$Resource.saveStatus}"/>
                                    </td>
                                </tr>
                            </table>
                        </apex:facet>
</apex:actionStatus>
              </apex:outputPanel>
         
            </apex:facet>
          </apex:actionstatus>
     </apex:outputPanel>
      <br/>
     <apex:pageBlockSection columns="1" >
     <script type="text/javascript">new MenuButton('MyMenu', false);</script>

    <apex:pageBlockTable id="dTable" value="{!contactList}" var="dat"  border="1" cellspacing="2px" width="100%" headerClass="he1" cellpadding="4px" columnsWidth="60px,150px,150px,150px,170px" >
     <apex:column ><apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this,'checkedone')"/>
</apex:facet>
<apex:inputCheckbox value="{!dat.selected}" id="checkedone"/></apex:column>
   <apex:column headerValue="First Name"  ><apex:outputField value="{!dat.con.FirstName}" rendered="{!IF(ISBLANK(dat.con.FirstName), 'false', 'true')}"/>
   </apex:column>
     <apex:column headerValue="Last Name" ><apex:outputField value="{!dat.con.LastName}" rendered="{!IF(ISBLANK(dat.con.LastName), 'false', 'true')}"/> 
      </apex:column>
     <apex:column headerValue="Title" ><apex:outputField value="{!dat.con.Title}" rendered="{!IF(ISBLANK(dat.con.Title), 'false', 'true')}"/>
     </apex:column>
     <apex:column headerValue="Account Name" ><apex:outputField value="{!dat.con.AccountId}" rendered="{!IF(ISBLANK(dat.con.AccountId), 'false', 'true')}"/> </apex:column>
     <apex:column headerValue="Email"  ><apex:outputField value="{!dat.con.Email}" rendered="{!IF(ISBLANK(dat.con.Email), 'false', 'true')}"/>
     </apex:column>
          </apex:pageBlockTable>
          </apex:pageBlockSection>
    
     &nbsp; &nbsp; <apex:commandLink action="{!previousResults}" value="Previous" reRender="emailTemplateBlock"/> &nbsp; | &nbsp; <apex:commandLink action="{!nextResults}" value="Next" reRender="dTable" />
       
   <br></br><br></br><apex:commandButton action="{!Save}" value="Continue..." disabled="emailTemplateBlock" onclick="emailTemplateBlock" reRender="displaypblock"/>
</apex:pageBlock>

        <apex:pageBlock title="Step 2: Select an email template" id="emailTemplateBlock" rendered="{!displaypblock}">
                Select Email Template Folder:
            <apex:selectList value="{!selectedEmailTemplateFolder}" multiselect="false" size="1">
                <apex:selectOptions value="{!emailTemplateFolderOpts}" />
                <apex:actionSupport event="onchange" action="{!refreshEmailTemplateSection}" rerender="emailTemplateBlock" />
            </apex:selectList>
            <br/><br></br>
            Select Email Template:
            <apex:selectList value="{!selectedEmailTemplate}" multiselect="false" size="1" >
                <apex:selectOptions value="{!emailTemplateOpts}" />
<apex:actionSupport event="onchange" action="{!refreshEmailTemplateSectionid}" rerender="emailTemplateBlock" />               
                            </apex:selectList>
             <apex:outputLink target="_blank" value="{!emailTemplateId}">Preview</apex:outputLink>            <br/><br></br>
                      
<apex:commandButton action="{!SendEmail}" value="Send Email" rendered="{!if(emailTemplateOpts.size > 0, true, false)}"/>
    </apex:pageBlock>  </apex:form>
</apex:page>



Florian HoehnFlorian Hoehn
Hi,

Without having looked at all your code. Check out the 'rendered' and 'reRender' attributes on pageBlockTable and actionButton/Functions respectively.

Hope this helps!

Florian
salesforcemicky125salesforcemicky125
Hi, Could you please help me in changing the Code , i cannot able to make the Changes. Regards Micky
salesforcemicky125salesforcemicky125
Hi Florain,

I have made some changes in the code as of you said , but i can achive what i am looking for . Could you please help me out  from this it would be great help.


Regards
Micky
salesforcemicky125salesforcemicky125
"Hi , I have a visual force page and an controller . We have a Button in my VF page called Continue ...> when i click on this button i want to display a page block with " Select Email Template Folder " and " Select Email Template" for selecting the Email Template type. Currently i have done with my requirement , but in Visual Force page Still i have some issues. When i click on the Continue Button i am getting the PageBlock open , but it is refreshing the whole page which should not happen , because user first selects the list of email and then he Click on the Continue button . On Clicking the continue button , it has refreshing the Whole because of this what the user has selected the List of email will be lost , this should not happen . On clicking the continue button i want to open a pageblock ,but not to refresh the whole page. can anyone help out looking to the above code what are the changes to be done. .mmSubheader { background-color= #E2E3E5; font size: 1em; margin: 18px 0 7px; padding: 4px 9px; color: black; font-weight:bold; } .label{ padding:3px; color: #222222;font-family: Arial,Helvetica,sans-serif; } .he1 { font-weight: bold; -moz-user-select: text; font-family: 'Arial','Helvetica',sans-serif; font-size: 100%; line-height: normal; border-style: none solid none none; border-width: 0 1px 0 0; padding: 2px 0 3px; vertical-align: baseline; border-left-color: #EEEEEE; border-right-color: #D0D0D0; border-left: 1px solid; border-right: 1px solid; -moz-user-focus: normal; outline: medium none; text-align: left; }
Select Event Name
Attended Attending Invited No Show Not Attending No Response
Choose Member Type to Search


      |  

Select Email Template Folder:

Select Email Template: Preview

Regards Micky On Mon, Jan 27, 2014 at 1:53 PM, salesforcemicky wrote: