• Santoshi
  • NEWBIE
  • 75 Points
  • Member since 2011

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies

Hi

 

I have two components A and B, which i am showing in my Client portal.

Right now i am showing both, but now i have to show only one. 

Can i have two buttons/links naming A and B, so by clicking on any one, that component with open.

 

Here is Component A code, (B is just similar with different google chart partameters).

 

<apex:component controller="TestChartController2a"> 
   <div>              

<img src="https://fdrclient.com/proxy-1.0/proxyproxiedUrl=http%3A%2F%2Fchart.apis.google.com}"/>           

</div> 
</apex:component>

 

Here is Visualforce page where i am caaling the components.

 

<apex:page showHeader="false" sidebar="false" standardController="Account">   

<apex:stylesheet value="{!$Resource.CustomerPortalCSS}"/>       

<div>       

<table>           

<tr>               

<td><c:Component_A /></td>               

<td><c:Component_B /></td>              

          </tr>       

</table>   

</div>

</apex:page>

 

Please provide a sample code to achieve that, if possible.

 

Thanks a lot

Sid

Hi

 

I am having difficulty in accessing a parameter passed in a URL from one viuslforce page to another. I have two pages (atrainingconfirmatation and  atrainingfconfirmation2). They both use the same controller. The first one prompts the user to select a company who has delegates on this event. The second print a confirmation form. The first page passes the selected accountid to the second. In the controller, I use the accountid to select all the delegates for the event for the passed accountid but am getting no data. This is the code where the passed parameter is used

 

   public List<CQS_Delegate__c> getdelegates(){
        delegate = [SELECT Contact__c,No_of_Delegates__c,Contact__r.Name,Dietary_Requirement__c,Account__r.Name,Payment_Status__c from CQS_Delegate__c WHERE Event__c =:eventid and Account__c=:accountpassedid];
             return delegate;
    }

 

Page1:

 

<apex:page Controller="TrainingConfirmation" sidebar="false"  showheader="false">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection title="Training Confirmation - Select Company" columns="1">
      <apex:pageblocksectionItem >
                  <apex:selectList value="{!accountId}" size="1" id="accountId">
              <apex:selectOptions value="{!accounts}"/>
          </apex:selectList>
      </apex:pageblocksectionItem>    
                            </apex:pageblocksection>           
  </apex:pageblock>

<apex:commandlink value="Click here to Generate Training Confirmation" action="{!genConfirm}"/>
</apex:form>
</apex:page>


 

Page2:

<apex:page Controller="TrainingConfirmation" renderas="PDF" sidebar="false"  showheader="false">

<html>
<head>
<style>
    body{
        font-family:Verdana, Geneva, sans-serif;
        font-size:12px;
    }
    .H1{
        color:#A3CC03;
        font-size:36px;
    }
    .H2{
        font-size:18px;
    }
    .table-heading1{
        color:#374B60;
        background-color:#CCC;
        font-weight:bold;
        padding:2px;
        font-size:14px;
    }
    .table-heading2{
        color:#374B60;
        background-color:#FFF;
        font-weight:bold;
    }
    .table-text{
        color:#374B60;
        background-color:#FFF;
        font-size:10px;
    }
    
    .table-bottom-line{
        border-top:solid 1px #374B60;
    }
    
    .statutory{
        font-size:10px;
    }
</style>

</head>
    <table width="720px" align="center" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center">
                <apex:image value="{!$Resource.CQSLogo}" />
            </td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center" class="H1">Training Confirmation</td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center" class="H2">Course: {!event.name}</td>
        </tr>
        <tr>
          <td style="text-align:center">Course Date: <apex:outputText value="{0,date, dd MMM yyyy}">
                                <apex:param value="{!event.Start_Date__c}"/>
                            </apex:outputText> 
                            </td>
</tr>
        <tr>
                                <td style="text-align:center">&nbsp;</td>
        </tr>
        <p></p>
        <br></br>
        <br></br>
           Date: <apex:outputText value="{0,date, dd MMM yyyy} "> 

        <apex:param value="{!NOW()}"/>
                            </apex:outputText> 
<br></br>
<br></br>
Thank you for booking the following Delegates on the above CaseWare Training Course<br></br>          
Payment for all training has to be made in advance. You will find our bank details on the attached invoice.<br></br>             
Please fax proof of payment to (011) 252 9424.          <br></br>
    <p></p>
<h3>Cancellation Policy:</h3>                
As our training courses are extremely popular, please note that bookings have to be cancelled in writing at least 5 working days                
prior to the scheduled training date. At NO time are telephonic cancellations acceptable.      <br></br>         
Late cancellations will be changed at R950.00 per delegate. Non attendance will be charged at the full course cost.<br></br>                 
Should full payment not reflect in our bank account, proof of payment may be requested on registration of the course.               
<p></p>
<p></p>

</table>        
        
          <table width="100%" border="0">
                    <tr>
                        <td class="table-heading2" width="340px">Delegate Name</td>
                        <td class="table-heading2" style="text-align:center" width="150px">Dietary Requirements</td>
                        <td class="table-heading2" style="text-align:center" width="60px">Delegates</td>
                        <td class="table-heading2" style="text-align:center" width="170px">Payment Status</td>
                    </tr>
                    <apex:repeat value="{!delegates}" var="cw">
                    <tr class="table-text">
                        <td>{!cw.Contact__r.Name}</td>
                        <td style="text-align:center">{!cw.Dietary_Requirement__c}</td>
                        <td style="text-align:center"><apex:outputText value="{0,number, ###,###}">
                                <apex:param value="{!cw.No_of_Delegates__c}"/>
                            </apex:outputText>
                        </td>
                        <td style="text-align:center">{!cw.Payment_Status__c}</td>
                                            </tr>
                    </apex:repeat>
                  
 </table>
 <br></br>
 <br></br>
 <br></br>
<h3>Training Venue:</h3>                
<table>
    <tr><td></td><td></td><td>{!event.Venue__r.Name}</td></tr>
    <tr><td></td><td></td><td>{!event.Venue__r.Address__c}</td></tr>

</table>
<br></br>
<br></br>
If you have any queries, please don't hesitate to contact us.

 </html>
</apex:page>

 

The Controller:

public class TrainingConfirmation{

    private Account account;
    public ID AccountID {get; set;}
    public List<CQS_Delegate__c> delegate = new List<CQS_Delegate__c>();
    
     private CQS_Event__c event;
     public Id eventid;
     public Id accountpassedid;
          
   public PageReference genConfirm() {  
   PageReference result=new PageReference('/apex/atrainingfconfirmation2');
      result.getParameters().put('eventid', event.id); 
      result.getParameters().put('company', accountId); 
   return result; }
 
 
    public TrainingConfirmation(){
        eventid  = ApexPages.currentPage().getParameters().get('eventid');        
        accountpassedid  = ApexPages.currentPage().getParameters().get('company');        
        event= [SELECT Id, Name,Start_Date__c,Venue__r.Name,Venue__r.Address__c FROM CQS_Event__c WHERE Id = :eventid limit 1];  

        
    }
            
    public CQS_Event__c getevent(){
        return event;
    }
          
   public List<CQS_Delegate__c> getdelegates(){
        delegate = [SELECT Contact__c,No_of_Delegates__c,Contact__r.Name,Dietary_Requirement__c,Account__r.Name,Payment_Status__c from CQS_Delegate__c WHERE Event__c =:eventid and Account__c=:accountpassedid];
             return delegate;
    }
    
    
    
    public List<SelectOption> accounts    {  
    get    {
     if (accounts == null) {
        accounts = new List<SelectOption>();
        List<Account> citylist = new List<Account>();  
        citylist = [Select Id, Name from Account where ID IN (Select Account__c from CQS_Delegate__C where Event__C =:eventid) ];  
        for (Integer j=0;j<citylist.size();j++)  
        {      
        accounts.add(new SelectOption(citylist[j].ID,citylist[j].Name));  
        }  
    }
   return accounts;
   }
    set;
}

}

 

Many thanks for any help!!

Ross

  • March 10, 2011
  • Like
  • 0

Hi,

 

I am trying to create a simple dependent picklist in Visual force. I am using apex: actionsupport tag to re-render the dependent picklist and select the specific values for it on the basis of selected value from main picklist.

 

Mani Picklist:  Project Office

Dependent Picklit : Building  

 

The issue I am facing is when I change the value of Main picklist (Project Office) it is re-rending the other picklist. But in getter of the child picklist( getTestBuildinglist() )  I am not getting the new selected value. So in getTestBuildinglist()  function the value of SelectProjectOffices is always ‘Select One’ . Idealy it should be the selected vale(‘ABC’ or ‘XYZ’ whatever user select from the Main picklist)

 

Any idea what I am missing or any other approach which can help me to implement this.

 

Here is the sample code

 

*************************VF PAGE*******************************

<apex:page controller="testController_Rajan" cache="false" id="myPage" showHeader="false" sidebar="false" standardStylesheets="true">  
 <apex:form id="myform">
 <apex:pageBlock id="mypageBlock">
 <!-- Creating Project Office picklist and binded with SelectProjectOffice contoller -->
 <apex:pageblockSection ><apex:pageBlockSectionItem >
<apex:outputLabel value="Project Office" for="ddProjectOffice"></apex:outputLabel>
<apex:selectList value="{!selectProjectOffices}" id="ddProjectOffice" size="1" required="true">
                        <apex:actionSupport event="onchange"  reRender="ddbuilding" immediate="true" />
                        <apex:selectOptions value="{!TestProjectOfficeslist}"/>
</apex:selectList>
</apex:pageBlockSectionItem>


<apex:pageBlockSectionItem >
                    <apex:outputLabel value="Building" for="ddbuilding"></apex:outputLabel>
                    <apex:selectList value="{!Buildingvalue}" disabled="{!EnabledBuilding}"  id="ddbuilding" size="1" required="true">
                    <apex:selectOptions value="{!TestBuildinglist}"/>
                    </apex:selectList>
</apex:pageBlockSectionItem>    
</apex:pageblockSection>

</apex:pageBlock>
</apex:form>  
</apex:page>

 

**************************APEX CLASS******************************************

 

public class testController_Rajan {

    public string Buildingvalue{ get; set; }
    public string selectBuilding;
    public String SelectProjectOffices;
    public List<SelectOption> optionBuliding=new List<SelectOption>();
    public boolean EnabledBuilding{get; set;}
    List<SelectOption> options = new List<SelectOption>();

 
            /*Getting values of Status picklist  of Case Object*/
            public List<SelectOption> getTestProjectOfficeslist()
            {
              
               if(SelectProjectOffices==null)
               {
               options.add(new SelectOption('Select One','Select One'));//set default value
               options.add(new SelectOption('ABC','ABC'));//set default value
               options.add(new SelectOption('XYZ','XYZ'));//set default value
               
               /*
               for(ProjectOfficeCusList__c poff : ProjectOfficeCusList__c.getAll().values())  
               options.add(new SelectOption(poff.name,poff.name));
               */
               
               SelectProjectOffices='Select One';
               setEnabledBuilding(true);
               }
               return options;
               
           }
           
           
          public List<SelectOption> getTestBuildinglist()           
          {
           
                   
               System.Debug(getSelectProjectOffices()); // Here is the issue. It is not providing the selected Value  
               optionBuliding.add(new SelectOption(SelectProjectOffices,SelectProjectOffices));//set default value
               
               /*
               if(SelectProjectOffices!='Select One')
               {
               for(Product2 p :[select p.Building__c  from Product2 p where p.Project_Office__c=:SelectProjectOffices])
               optionBuliding.add(new SelectOption(p.Building__c, p.Building__c));
               }
               */
               setEnabledBuilding(false);
               return optionBuliding;
          
           }
           
            public String getSelectProjectOffices() {
            return this.SelectProjectOffices;
            }
            
            public void setSelectProjectOffices(String S) {
                this.SelectProjectOffices= S;
            }
            
            public Void setEnabledBuilding(Boolean b) {
                this.EnabledBuilding=b;
            }
 
 }

 

***********************************************************************************

 

Any help is appreciated.

 

Regards,

Rajan

How to reference a child object and call the child object records in a visualforce page with master object as standard controller

Hi

 

I have two components A and B, which i am showing in my Client portal.

Right now i am showing both, but now i have to show only one. 

Can i have two buttons/links naming A and B, so by clicking on any one, that component with open.

 

Here is Component A code, (B is just similar with different google chart partameters).

 

<apex:component controller="TestChartController2a"> 
   <div>              

<img src="https://fdrclient.com/proxy-1.0/proxyproxiedUrl=http%3A%2F%2Fchart.apis.google.com}"/>           

</div> 
</apex:component>

 

Here is Visualforce page where i am caaling the components.

 

<apex:page showHeader="false" sidebar="false" standardController="Account">   

<apex:stylesheet value="{!$Resource.CustomerPortalCSS}"/>       

<div>       

<table>           

<tr>               

<td><c:Component_A /></td>               

<td><c:Component_B /></td>              

          </tr>       

</table>   

</div>

</apex:page>

 

Please provide a sample code to achieve that, if possible.

 

Thanks a lot

Sid

Hi All,

 

I am using the Yahoo GUI in visualforce page 1 to open a dialog window. Within the dialog window I am opening visual force page 2 as an Iframe. 

Page 1 has  a grid of cases with a column for outputlink that will call the javascript to open the dialog box and pass the case Id to the script. This is where it fails because it keeps sending only the case id of the first case in the grid and not does not do it dynamically. Any help in getting this going will be appreciated.

<apex:page controller="caseController1" showheader="false" standardStylesheets="false">
    <apex:stylesheet value="{!URLFOR($Resource.Styles,'/css/core.css')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.Styles,'/css/s.css')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.Styles,'/css/shadowbox.css')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.Styles,'/css/portal.css')}"/>
    <apex:stylesheet value="http://yui.yahooapis.com/2.6.0/build/assets/skins/sam/skin.css" /> 
    <apex:includescript value="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js" />
    <apex:includescript value="http://yui.yahooapis.com/2.6.0/build/dragdrop/dragdrop-min.js" />
    <apex:includescript value="http://yui.yahooapis.com/2.6.0/build/container/container-min.js"/>
    <apex:includescript value="http://yui.yahooapis.com/2.6.0/build/animation/animation-min.js"/>
    <script>
        YAHOO.namespace("force.com");
        YAHOO.force.com.showComment = function(cId) {
            document.getElementById("mycomment").style.display = "block";
            document.getElementById("commentframe").setAttribute("src", "/apex/addComments_20?caseId="+cId);
            YAHOO.force.com.myDialogC.show();
        }
        YAHOO.force.com.showAttachment = function(caseId) {
            alert(caseId);
            document.getElementById("myattachment").style.display = "block";
            document.getElementById("attachmentframe").setAttribute("src", "/apex/addAttachment?cId="+caseId);
            YAHOO.force.com.myDialogA.show();
            caseid='';
        }
        YAHOO.force.com.hideComment = function() {
            YAHOO.force.com.myDialogC.hide();
        }
        YAHOO.force.com.hideAttachment = function() {
            YAHOO.force.com.myDialogA.hide();
        }
        YAHOO.force.com.init = function() {
            document.body.className = document.body.className + " yui-skin-sam";
            YAHOO.force.com.myDialogC = new YAHOO.widget.Panel(
                "mycomment",
                { 
                    width           :   "400px",
                    visible         :   false,
                    height          :   "150px",
                    xy              :  [350,50],
                    draggable       :   true,
                    close           :   true,
                    modal           :   true,
                    fixedCenter     :   true,
                    zindex          :   40,
                    effect          :   {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.35} 
                }
            );
            YAHOO.force.com.myDialogC.render(document.body);
            YAHOO.force.com.myDialogA = new YAHOO.widget.Panel(
                "myattachment",
                { 
                    width           :   "425px",
                    visible         :   false,
                    height          :   "175px",
                    xy              :  [350,50],
                    draggable       :   true,
                    close           :   true,
                    modal           :   true,
                    fixedCenter     :   true,
                    zindex          :   40,
                    effect          :   {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.35} 
                }
            );
            YAHOO.force.com.myDialogA.render(document.body);
        }
        YAHOO.util.Event.addListener(window, "load", YAHOO.force.com.init);
    </script>
    <apex:insert name="header">
        <c:PortalHeader />
    </apex:insert>
    <div id="container">
        <div id="content">
             <div id="left">
                <c:PortalNavLeftCases /> 
                <c:PortalNavLeftQuickLinks />
            </div>
            <div id="main">
                <div class="pagesection">
                    <apex:pagemessages />
                    <div class="topline">My Support Cases
                        <apex:form >
                            <apex:commandLink action="{!openNewCase}">
                                <apex:image style="float: right; width: 66px; height: 24px; margin-top: -21px; margin-right: 6px; padding-right:6px; padding-top:2px;" url="{!URLFOR($Resource.Styles,'/i/icons/new-case-btn-a.png')}"/>
                            </apex:commandLink>
                        </apex:form>
                    </div> <!-- closing topline div -->
                        <div style="overflow: auto; font-weight: normal; height: 350px; text-align: left;">
                            <apex:dataTable value="{!Cases}" var="c" id="cases" rowClasses="even,odd">
                                <apex:column headerValue="Case #" width="10%">
                                    <apex:outputText value="{!c.CaseNumber}" />
                                </apex:column>
                                <apex:column headerValue="Subject" width="30%">
                                    <apex:outputText value="{!c.Subject}" />
                                </apex:column>
                                <apex:column headerValue="Status" width="10%">
                                    <apex:outputText value="{!c.Status}" />
                                </apex:column>
                                <apex:column width="15%" style="text-align:right;">
                                    <apex:form >
                                    <apex:commandLink value="Add Comments" onclick="YAHOO.force.com.showComment('{!c.Id}');" reRender="noaction">
                                    </apex:commandLink>
                                    </apex:form>
                                </apex:column>
                                <apex:column width="15%" style="text-align:right;">
                                    <apex:form >
                                    <apex:commandLink value="Attach a File" onclick="YAHOO.force.com.showAttachment('{!c.Id}');" reRender="noaction">
                                    </apex:commandLink>
                                    </apex:form>
                                </apex:column>
                            </apex:dataTable>
                        </div> <!-- closing form div -->
                </div> <!-- closing pagesection div -->
                <p><strong>Contact Support</strong></p>
                <p>Contact CORAID Support for technical help, customer service questions and account assistance <i>
                <a href="mailto:support@coraid.com">support@coraid.com</a>.</i></p>
            </div> <!-- closing main div -->
        </div> <!-- closing content div -->
    </div> <!-- closing container div -->
    <apex:insert name="footer">
        <c:PortalFooter />
    </apex:insert>
    <apex:form >
        <div id="mycomment" style="display: none">
            <div class="hd">
                <apex:outputText value="Add Comments" />
            </div>
            <div class="bd" style="overflow:auto; background-color:fff;padding:10px;">
                <apex:iframe height="260px" width="400px" id="commentframe"/>
            </div>
        </div>
    </apex:form>
    <apex:form >
        <div id="myattachment" style="display: none">
            <div class="hd">
                <apex:outputText value="Add Attachments" />
            </div>
            <div class="bd" style="overflow:auto;background-color:fff;padding:10px;">
                <apex:iframe height="325px" width="415px" id="attachmentframe" scrolling="false"/>
            </div>
        </div>
    </apex:form>
    <apex:outputPanel id="noaction">
    </apex:outputPanel>
</apex:page>

That is code. Assistance required in passing the correct case Id when the link against that line is clicked.

 

Thanks

KD

  • July 22, 2011
  • Like
  • 0

Hi,

 

Our users would like for the VF page their using load instantaneously upon selecting an answer option for a record within their checklist.

 

I would highly appreciate if anyone can help me in this end as I am new to apex/visualforce development and have tried looking for answers through the discussion board but am still struggling to implement this performance improvement request.

 

Visualforce Page Code:

 

<apex:page StandardController="Checklist_Item__c" extensions="CollectChecklistItemsExtension" recordSetvar="ChecklistItems" sidebar="false">
    <apex:form > 
        <apex:pageBlock title="Edit Checklist Item Data" id="idPageBlock" mode="edit">
            <apex:pageMessages /> 
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockTable value="{!ChecklistItems}" var="c" id="idPageBlockTable">
    
                <apex:column value="{!c.Id}" rendered="false" />
                
                <apex:column value="{!c.Question_Category__c}" headerValue="Category" />                
                
                <apex:column value="{!c.Question__c}" /> 
                
                <apex:column headerValue="Answer">
                    <apex:outputPanel id="idAnswerOutputPanel" >
                        <apex:inputField value="{!c.Answer__c}">
                        <apex:actionSupport event="onchange" reRender="idPageBlock" immediate="true" status="idStatus"/>
                        </apex:inputField>
                        <apex:actionStatus startText="processing..." id="idStatus"/>
                    </apex:outputPanel>  
                </apex:column>

                <apex:column headerValue="Comment">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Comments__c}" />
                </apex:column>

                <apex:column headerValue="Issue">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == ''}"/>
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'Yes'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Issue__c}" rendered="{!c.Answer__c == 'No'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Issue__c}" rendered="{!c.Answer__c == 'In-Part A'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Issue__c}" rendered="{!c.Answer__c == 'In-Part B'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Issue__c}" rendered="{!c.Answer__c == 'In-Part C'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'N/A'}" />                 
                </apex:column>    
                                
                <apex:column headerValue="Action">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == ''}" />               
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'Yes'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Action__c}" rendered="{!c.Answer__c == 'No'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Action__c}" rendered="{!c.Answer__c == 'In-Part A'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Action__c}" rendered="{!c.Answer__c == 'In-Part B'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Action__c}" rendered="{!c.Answer__c == 'In-Part C'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'N/A'}" />
                </apex:column>

            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Many thanks.

 

  • March 15, 2011
  • Like
  • 0

Hi

 

I am having difficulty in accessing a parameter passed in a URL from one viuslforce page to another. I have two pages (atrainingconfirmatation and  atrainingfconfirmation2). They both use the same controller. The first one prompts the user to select a company who has delegates on this event. The second print a confirmation form. The first page passes the selected accountid to the second. In the controller, I use the accountid to select all the delegates for the event for the passed accountid but am getting no data. This is the code where the passed parameter is used

 

   public List<CQS_Delegate__c> getdelegates(){
        delegate = [SELECT Contact__c,No_of_Delegates__c,Contact__r.Name,Dietary_Requirement__c,Account__r.Name,Payment_Status__c from CQS_Delegate__c WHERE Event__c =:eventid and Account__c=:accountpassedid];
             return delegate;
    }

 

Page1:

 

<apex:page Controller="TrainingConfirmation" sidebar="false"  showheader="false">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection title="Training Confirmation - Select Company" columns="1">
      <apex:pageblocksectionItem >
                  <apex:selectList value="{!accountId}" size="1" id="accountId">
              <apex:selectOptions value="{!accounts}"/>
          </apex:selectList>
      </apex:pageblocksectionItem>    
                            </apex:pageblocksection>           
  </apex:pageblock>

<apex:commandlink value="Click here to Generate Training Confirmation" action="{!genConfirm}"/>
</apex:form>
</apex:page>


 

Page2:

<apex:page Controller="TrainingConfirmation" renderas="PDF" sidebar="false"  showheader="false">

<html>
<head>
<style>
    body{
        font-family:Verdana, Geneva, sans-serif;
        font-size:12px;
    }
    .H1{
        color:#A3CC03;
        font-size:36px;
    }
    .H2{
        font-size:18px;
    }
    .table-heading1{
        color:#374B60;
        background-color:#CCC;
        font-weight:bold;
        padding:2px;
        font-size:14px;
    }
    .table-heading2{
        color:#374B60;
        background-color:#FFF;
        font-weight:bold;
    }
    .table-text{
        color:#374B60;
        background-color:#FFF;
        font-size:10px;
    }
    
    .table-bottom-line{
        border-top:solid 1px #374B60;
    }
    
    .statutory{
        font-size:10px;
    }
</style>

</head>
    <table width="720px" align="center" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center">
                <apex:image value="{!$Resource.CQSLogo}" />
            </td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center" class="H1">Training Confirmation</td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:center" class="H2">Course: {!event.name}</td>
        </tr>
        <tr>
          <td style="text-align:center">Course Date: <apex:outputText value="{0,date, dd MMM yyyy}">
                                <apex:param value="{!event.Start_Date__c}"/>
                            </apex:outputText> 
                            </td>
</tr>
        <tr>
                                <td style="text-align:center">&nbsp;</td>
        </tr>
        <p></p>
        <br></br>
        <br></br>
           Date: <apex:outputText value="{0,date, dd MMM yyyy} "> 

        <apex:param value="{!NOW()}"/>
                            </apex:outputText> 
<br></br>
<br></br>
Thank you for booking the following Delegates on the above CaseWare Training Course<br></br>          
Payment for all training has to be made in advance. You will find our bank details on the attached invoice.<br></br>             
Please fax proof of payment to (011) 252 9424.          <br></br>
    <p></p>
<h3>Cancellation Policy:</h3>                
As our training courses are extremely popular, please note that bookings have to be cancelled in writing at least 5 working days                
prior to the scheduled training date. At NO time are telephonic cancellations acceptable.      <br></br>         
Late cancellations will be changed at R950.00 per delegate. Non attendance will be charged at the full course cost.<br></br>                 
Should full payment not reflect in our bank account, proof of payment may be requested on registration of the course.               
<p></p>
<p></p>

</table>        
        
          <table width="100%" border="0">
                    <tr>
                        <td class="table-heading2" width="340px">Delegate Name</td>
                        <td class="table-heading2" style="text-align:center" width="150px">Dietary Requirements</td>
                        <td class="table-heading2" style="text-align:center" width="60px">Delegates</td>
                        <td class="table-heading2" style="text-align:center" width="170px">Payment Status</td>
                    </tr>
                    <apex:repeat value="{!delegates}" var="cw">
                    <tr class="table-text">
                        <td>{!cw.Contact__r.Name}</td>
                        <td style="text-align:center">{!cw.Dietary_Requirement__c}</td>
                        <td style="text-align:center"><apex:outputText value="{0,number, ###,###}">
                                <apex:param value="{!cw.No_of_Delegates__c}"/>
                            </apex:outputText>
                        </td>
                        <td style="text-align:center">{!cw.Payment_Status__c}</td>
                                            </tr>
                    </apex:repeat>
                  
 </table>
 <br></br>
 <br></br>
 <br></br>
<h3>Training Venue:</h3>                
<table>
    <tr><td></td><td></td><td>{!event.Venue__r.Name}</td></tr>
    <tr><td></td><td></td><td>{!event.Venue__r.Address__c}</td></tr>

</table>
<br></br>
<br></br>
If you have any queries, please don't hesitate to contact us.

 </html>
</apex:page>

 

The Controller:

public class TrainingConfirmation{

    private Account account;
    public ID AccountID {get; set;}
    public List<CQS_Delegate__c> delegate = new List<CQS_Delegate__c>();
    
     private CQS_Event__c event;
     public Id eventid;
     public Id accountpassedid;
          
   public PageReference genConfirm() {  
   PageReference result=new PageReference('/apex/atrainingfconfirmation2');
      result.getParameters().put('eventid', event.id); 
      result.getParameters().put('company', accountId); 
   return result; }
 
 
    public TrainingConfirmation(){
        eventid  = ApexPages.currentPage().getParameters().get('eventid');        
        accountpassedid  = ApexPages.currentPage().getParameters().get('company');        
        event= [SELECT Id, Name,Start_Date__c,Venue__r.Name,Venue__r.Address__c FROM CQS_Event__c WHERE Id = :eventid limit 1];  

        
    }
            
    public CQS_Event__c getevent(){
        return event;
    }
          
   public List<CQS_Delegate__c> getdelegates(){
        delegate = [SELECT Contact__c,No_of_Delegates__c,Contact__r.Name,Dietary_Requirement__c,Account__r.Name,Payment_Status__c from CQS_Delegate__c WHERE Event__c =:eventid and Account__c=:accountpassedid];
             return delegate;
    }
    
    
    
    public List<SelectOption> accounts    {  
    get    {
     if (accounts == null) {
        accounts = new List<SelectOption>();
        List<Account> citylist = new List<Account>();  
        citylist = [Select Id, Name from Account where ID IN (Select Account__c from CQS_Delegate__C where Event__C =:eventid) ];  
        for (Integer j=0;j<citylist.size();j++)  
        {      
        accounts.add(new SelectOption(citylist[j].ID,citylist[j].Name));  
        }  
    }
   return accounts;
   }
    set;
}

}

 

Many thanks for any help!!

Ross

  • March 10, 2011
  • Like
  • 0

Hi,

 

One of our user groups is using a custom VF page to consolidate their field work information in a form of a survey.

The problem with the existing VF page they are using is that it takes ages to load the default issue and action information for the option they have selected for a question item.

 

I am relatively new to Salesforce and was asked to look into and address this performance issue. 

 

Appreciate the help, thanks.

 

VF Page Code

<apex:page standardController="Checklist_Item__c"  extensions="CollectChecklistItemsExtension" sidebar="false">
    <apex:form > 
        
        <apex:pageBlock title="Edit Checklist Item Data" id="idPageBlock1" mode="edit">
            
            <apex:pageMessages /> 
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockTable value="{!ChecklistItems}" var="c" id="idPageBlockTable1">
                
                <apex:column value="{!c.Id}" rendered="false" />
                
                <apex:column value="{!c.Question_Category__c}" headerValue="Category" />                
                
                <apex:column value="{!c.Question__c}" /> 
                
                <apex:column headerValue="Answer">
                    <apex:outputPanel id="idAnswerOutputPanel" >
                        <apex:inputField value="{!c.Answer__c}">
                        <apex:actionSupport event="onchange" 
                                            rerender="idPageBlock1"
                                            status="idStatus"/>
                        </apex:inputField>
                        <apex:actionStatus startText="processing..." id="idStatus"/>
                    </apex:outputPanel>  
                </apex:column>

                <apex:column headerValue="Comment">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Comments__c}" />
                </apex:column>

                <apex:column headerValue="Issue">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == ''}"/>
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'Yes'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Issue__c}" rendered="{!c.Answer__c == 'No'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Issue__c}" rendered="{!c.Answer__c == 'In-Part A'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Issue__c}" rendered="{!c.Answer__c == 'In-Part B'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Issue__c}" rendered="{!c.Answer__c == 'In-Part C'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'N/A'}" />                 
                </apex:column>    
                                
                <apex:column headerValue="Action">
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == ''}" />               
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'Yes'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Action__c}" rendered="{!c.Answer__c == 'No'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Action__c}" rendered="{!c.Answer__c == 'In-Part A'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Action__c}" rendered="{!c.Answer__c == 'In-Part B'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Action__c}" rendered="{!c.Answer__c == 'In-Part C'}" />
                    <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'N/A'}" />
                </apex:column>

            </apex:pageBlockTable>

        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

 


 

 

 

 

  • March 03, 2011
  • Like
  • 0

Hi,

 

I am trying to create a simple dependent picklist in Visual force. I am using apex: actionsupport tag to re-render the dependent picklist and select the specific values for it on the basis of selected value from main picklist.

 

Mani Picklist:  Project Office

Dependent Picklit : Building  

 

The issue I am facing is when I change the value of Main picklist (Project Office) it is re-rending the other picklist. But in getter of the child picklist( getTestBuildinglist() )  I am not getting the new selected value. So in getTestBuildinglist()  function the value of SelectProjectOffices is always ‘Select One’ . Idealy it should be the selected vale(‘ABC’ or ‘XYZ’ whatever user select from the Main picklist)

 

Any idea what I am missing or any other approach which can help me to implement this.

 

Here is the sample code

 

*************************VF PAGE*******************************

<apex:page controller="testController_Rajan" cache="false" id="myPage" showHeader="false" sidebar="false" standardStylesheets="true">  
 <apex:form id="myform">
 <apex:pageBlock id="mypageBlock">
 <!-- Creating Project Office picklist and binded with SelectProjectOffice contoller -->
 <apex:pageblockSection ><apex:pageBlockSectionItem >
<apex:outputLabel value="Project Office" for="ddProjectOffice"></apex:outputLabel>
<apex:selectList value="{!selectProjectOffices}" id="ddProjectOffice" size="1" required="true">
                        <apex:actionSupport event="onchange"  reRender="ddbuilding" immediate="true" />
                        <apex:selectOptions value="{!TestProjectOfficeslist}"/>
</apex:selectList>
</apex:pageBlockSectionItem>


<apex:pageBlockSectionItem >
                    <apex:outputLabel value="Building" for="ddbuilding"></apex:outputLabel>
                    <apex:selectList value="{!Buildingvalue}" disabled="{!EnabledBuilding}"  id="ddbuilding" size="1" required="true">
                    <apex:selectOptions value="{!TestBuildinglist}"/>
                    </apex:selectList>
</apex:pageBlockSectionItem>    
</apex:pageblockSection>

</apex:pageBlock>
</apex:form>  
</apex:page>

 

**************************APEX CLASS******************************************

 

public class testController_Rajan {

    public string Buildingvalue{ get; set; }
    public string selectBuilding;
    public String SelectProjectOffices;
    public List<SelectOption> optionBuliding=new List<SelectOption>();
    public boolean EnabledBuilding{get; set;}
    List<SelectOption> options = new List<SelectOption>();

 
            /*Getting values of Status picklist  of Case Object*/
            public List<SelectOption> getTestProjectOfficeslist()
            {
              
               if(SelectProjectOffices==null)
               {
               options.add(new SelectOption('Select One','Select One'));//set default value
               options.add(new SelectOption('ABC','ABC'));//set default value
               options.add(new SelectOption('XYZ','XYZ'));//set default value
               
               /*
               for(ProjectOfficeCusList__c poff : ProjectOfficeCusList__c.getAll().values())  
               options.add(new SelectOption(poff.name,poff.name));
               */
               
               SelectProjectOffices='Select One';
               setEnabledBuilding(true);
               }
               return options;
               
           }
           
           
          public List<SelectOption> getTestBuildinglist()           
          {
           
                   
               System.Debug(getSelectProjectOffices()); // Here is the issue. It is not providing the selected Value  
               optionBuliding.add(new SelectOption(SelectProjectOffices,SelectProjectOffices));//set default value
               
               /*
               if(SelectProjectOffices!='Select One')
               {
               for(Product2 p :[select p.Building__c  from Product2 p where p.Project_Office__c=:SelectProjectOffices])
               optionBuliding.add(new SelectOption(p.Building__c, p.Building__c));
               }
               */
               setEnabledBuilding(false);
               return optionBuliding;
          
           }
           
            public String getSelectProjectOffices() {
            return this.SelectProjectOffices;
            }
            
            public void setSelectProjectOffices(String S) {
                this.SelectProjectOffices= S;
            }
            
            public Void setEnabledBuilding(Boolean b) {
                this.EnabledBuilding=b;
            }
 
 }

 

***********************************************************************************

 

Any help is appreciated.

 

Regards,

Rajan

Hi,

 

I have created a public visualforce page that allows non-licensed users to enter data related to our accounts. This visulforce page is feeding a custom object titled Productivity. The users can visit the site but there are two issues that occur when trying to enter and save data:

 

1. Only the Project Number field is available for data entry -- all others fileds are closed

2. When clicking Save, the user gets a an Authorization Required error

 

I have pasted the code below. I have enabled debug logs but cannot find any exception errors.

 

Any guidance and recommendations are greatly appreciated!

 

Thanks,

Carlos

<apex:page standardController="Productivity__c">
<center>
<h1>Welcome to the Boart Productivity Suite</h1>
<br/><br/>
</center>
<apex:form id="ProductivityForm">
    <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!Productivity__c}" var="p">
        <apex:column headerValue="Enter Your Details">
            <table>
                <tr>
                    <td>Project Number:</td><td><apex:inputField value="{!p.Project_Number__c}"/></td>
                    <td>Customer:</td><td><apex:inputField value="{!p.Cust_Name__c}"/></td>
                    <td>Date:</td><td><apex:inputField value="{!p.Date__c}"/></td>
                </tr>
                <tr>
                    <td>Region:</td><td><apex:inputField value="{!p.DS_Region__c}"/></td>
                    <td>Zone:</td><td><apex:inputField value="{!p.DS_Zone__c}"/></td>
                    <td>Branch:</td><td><apex:inputField value="{!p.DS_Branch__c}"/></td>                    
                </tr>
                <tr>
                    <td>Rig:</td><td><apex:inputField value="{!p.Rig__c}"/></td>                
                    <td>Shift Number:</td><td><apex:inputField value="{!p.Shift_Number__c}"/></td>
                    <td>UOM:</td><td><apex:inputField value="{!p.UOM__c}"/></td>
                    
                </tr>
                <tr>
                    <td>Drill Amt:</td><td><apex:inputField value="{!p.Drill_Amt__c}"/></td>                    
                    <td>Drill Hours:</td><td><apex:inputField value="{!p.Drill_Hrs__c}"/></td>                    
                    <td>Other Billable Hours:</td><td><apex:inputField value="{!p.Oth_Billable_Hrs__c}"/></td>
                </tr>
                <tr>
                    <td>Billable Reason:</td><td><apex:inputField value="{!p.Billable_Reason__c}"/></td>
                    <td>Other Non-Billable Hours:</td><td><apex:inputField value="{!p.Oth_Nonbillable_Hrs__c}"/></td>                
                    <td>Non Billable Reason:</td><td><apex:inputField value="{!p.Non_Billable_Reason__c}"/></td>
                </tr>
            </table>
        </apex:column>
        </apex:pageBlockTable>        
    </apex:pageBlock>

</apex:form>
</apex:page>