• sanjeev342
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies

I'm trying to display picklists on my custom VF page. These picklists, Prefix__c and Suffix__c are both custom fields in the Contact object. I am using the following code, but I keep getting the following error:

 

Method does not exist or incorrect signature: [String].getDescribe();

 


This example has been used by many people and they seem to get it working. I'm not sure what's happening here. Here's my code:

 

    public List<SelectOption> getCountries()
    {
        List<SelectOption> options = new List<SelectOption>();
        
        Schema.DescribeFieldResult fieldResult =
            Contact.Prefix__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
        for( Schema.PicklistEntry f : ple)
        {
            options.add(new SelectOption(f.getLabel(), f.getValue()));
        }       
        return options;
    }

 

Thanks,
Sanjeev

I would like my dataTable to display: No Records Found whenever there are no records to be retrieved.

 

Currently, I am doing this by putting an <apex:outputText/> field right outside of the dataTable. However, I would like the text to display inside of the dataTable, i.e. within any border it has.

 

How is this achievable? When moving the outputText within the dataTable tags, it became invisible.

 

Code:

<apex:dataTable value="{!ExamHistoryRecords}" var="ExamHistoryRecord" styleClass="myCFRETable" >
    <apex:column headerValue="Test Window">
        <apex:outputText value="{!ExamHistoryRecord.Exam_Window_Start_Date}"/>
    </apex:column>
    <apex:column headerValue="Result">
        <apex:outputText value="{!ExamHistoryRecord.Exam_Result}"/>
    </apex:column>
    <apex:column headerValue="Application Type">
        <apex:outputText value="{!ExamHistoryRecord.Application_Type}" style="white-space:nowrap;"/>
    </apex:column>
</apex:dataTable>
<apex:outputLabel value="{!ExamHistoryIsEmpty}" style="font-style:italic;"/>

 

Thanks,

Sanjeev

Part of my page is a client table that also allows me to insert values into it.

 

How do I insert values and have the table dynamically updated?

 

Code:

    public List<Client__c> clientList {get; set;}
    public Client__c client {get; set;}

 

public void updateClientList(){
        if(clientList == null)
        {
            clientList = new List<Client__c>();
        }
        
        clientList = [SELECT Name, Professional_PracticeID__c, Client_Name__c, StartDate__c, EndDate__c, Pro_Bono__c,  
                      Description__c FROM Client__c WHERE Professional_PracticeID__c=:ProfPracticeID];
        if(client != null){
            clientList.add(client);
        }
        
    }

 

 

      <apex:pageBlock >
            
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Add Client" action="{!updateClientList}" reRender="clientDataPanel" />
        </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1" >
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Client Name" />
            <apex:inputField value="{!client.Client_Name__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Description" />
            <apex:inputField value="{!client.Description__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Start Date" />
            <apex:inputField id="ClientStartDate" value="{!client.StartDate__c}" styleClass="requiredValidation dateField ValidMMYYYY"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >  
            <apex:outputLabel value="End Date" />
            <apex:inputField id="ClientEndDate" value="{!client.EndDate__c}" styleClass="requiredValidation dateField ValidMMYYYY"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Pro-Bono" />
            <apex:inputField value="{!client.Pro_Bono__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        </apex:pageBlock>
            
            <apex:outputPanel id="clientDataPanel">
                
                <apex:dataTable id="clientDataTable" value="{!clientList}" var="clientRecord" width="100%" rendered="{!IF(clientList != null, true, false)}">
                    <apex:column headerValue="Client Name" width="30%">
                        <apex:outputText value="{!clientRecord.Client_Name__c}"/>
                    </apex:column>
                    <apex:column headerValue="Description of Fund Raising Activities" width="30%">
                        <apex:outputField value="{!clientRecord.Description__c}"/>
                    </apex:column>
                    <apex:column headerValue="Start Date" width="20%">
                        <apex:outputText value="{!clientRecord.StartDate__c}"/>
                    </apex:column>
                    <apex:column headerValue="End Date" width="20%" >
                        <apex:outputText value="{!clientRecord.EndDate__c}"/>
                    </apex:column>
                    <apex:column headerValue="Pro-Bono" width="10%">
                        <apex:outputText value="{!IF(clientRecord.Pro_Bono__c, 'Yes', 'No')}"/>
                    </apex:column>
                </apex:dataTable>
            </apex:outputPanel>

 

This is what I have, and have no clue why it doesn't work. The button doesn't do anything when clicked.

 

Thanks,

Sanjeev

I'm trying to create a rule.

 

IF(value X is selected in picklist)   ------->  THEN( make sure List Y has at least one value)

 

 

How do you find the value of a picklist in a Controller Class?

 

 

Thanks,

Sanjeev

I have a requirement where a datatable of clients must be hidden by default (i.e. on page load). The table appears and populates only when a certain command link is clicked. How do I go about achieving this?

 

This is the datatable I have so far:

 

<apex:dataTable id="clientDataTable" value="{!clientList}"
            				var="clientRecord" width="100%">
                <apex:column headerValue="Client Name" width="30%">
                    <apex:outputText value="{!clientRecord.Client_Name__c}"/>
                </apex:column>
                <apex:column headerValue="Description of Fund Raising Activities" width="30%">
                    <apex:outputField value="{!clientRecord.Description__c}"/>
                </apex:column>
                <apex:column headerValue="Start Date" width="20%">
                    <apex:outputText value="{!clientRecord.Start_Date__c}"/>
                </apex:column>
                <apex:column headerValue="End Date" width="20%" >
                    <apex:outputText value="{!clientRecord.End_Date__c}"/>
                </apex:column>
                <apex:column headerValue="Pro-Bono" width="10%">
                    <apex:outputText value="{!IF(clientRecord.Pro_Bono__c, 'Yes', 'No')}"/>
                </apex:column>
            </apex:dataTable>

 


Thanks,

Sanjeev

Part of my page is a client table that also allows me to insert values into it.

 

How do I insert values and have the table dynamically updated?

 

Code:

    public List<Client__c> clientList {get; set;}
    public Client__c client {get; set;}

 

public void updateClientList(){
        if(clientList == null)
        {
            clientList = new List<Client__c>();
        }
        
        clientList = [SELECT Name, Professional_PracticeID__c, Client_Name__c, StartDate__c, EndDate__c, Pro_Bono__c,  
                      Description__c FROM Client__c WHERE Professional_PracticeID__c=:ProfPracticeID];
        if(client != null){
            clientList.add(client);
        }
        
    }

 

 

      <apex:pageBlock >
            
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Add Client" action="{!updateClientList}" reRender="clientDataPanel" />
        </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1" >
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Client Name" />
            <apex:inputField value="{!client.Client_Name__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Description" />
            <apex:inputField value="{!client.Description__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Start Date" />
            <apex:inputField id="ClientStartDate" value="{!client.StartDate__c}" styleClass="requiredValidation dateField ValidMMYYYY"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >  
            <apex:outputLabel value="End Date" />
            <apex:inputField id="ClientEndDate" value="{!client.EndDate__c}" styleClass="requiredValidation dateField ValidMMYYYY"/>
        </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Pro-Bono" />
            <apex:inputField value="{!client.Pro_Bono__c}" styleClass="requiredValidation"/>
        </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        </apex:pageBlock>
            
            <apex:outputPanel id="clientDataPanel">
                
                <apex:dataTable id="clientDataTable" value="{!clientList}" var="clientRecord" width="100%" rendered="{!IF(clientList != null, true, false)}">
                    <apex:column headerValue="Client Name" width="30%">
                        <apex:outputText value="{!clientRecord.Client_Name__c}"/>
                    </apex:column>
                    <apex:column headerValue="Description of Fund Raising Activities" width="30%">
                        <apex:outputField value="{!clientRecord.Description__c}"/>
                    </apex:column>
                    <apex:column headerValue="Start Date" width="20%">
                        <apex:outputText value="{!clientRecord.StartDate__c}"/>
                    </apex:column>
                    <apex:column headerValue="End Date" width="20%" >
                        <apex:outputText value="{!clientRecord.EndDate__c}"/>
                    </apex:column>
                    <apex:column headerValue="Pro-Bono" width="10%">
                        <apex:outputText value="{!IF(clientRecord.Pro_Bono__c, 'Yes', 'No')}"/>
                    </apex:column>
                </apex:dataTable>
            </apex:outputPanel>

 

This is what I have, and have no clue why it doesn't work. The button doesn't do anything when clicked.

 

Thanks,

Sanjeev

I'm trying to create a rule.

 

IF(value X is selected in picklist)   ------->  THEN( make sure List Y has at least one value)

 

 

How do you find the value of a picklist in a Controller Class?

 

 

Thanks,

Sanjeev

I have a requirement where a datatable of clients must be hidden by default (i.e. on page load). The table appears and populates only when a certain command link is clicked. How do I go about achieving this?

 

This is the datatable I have so far:

 

<apex:dataTable id="clientDataTable" value="{!clientList}"
            				var="clientRecord" width="100%">
                <apex:column headerValue="Client Name" width="30%">
                    <apex:outputText value="{!clientRecord.Client_Name__c}"/>
                </apex:column>
                <apex:column headerValue="Description of Fund Raising Activities" width="30%">
                    <apex:outputField value="{!clientRecord.Description__c}"/>
                </apex:column>
                <apex:column headerValue="Start Date" width="20%">
                    <apex:outputText value="{!clientRecord.Start_Date__c}"/>
                </apex:column>
                <apex:column headerValue="End Date" width="20%" >
                    <apex:outputText value="{!clientRecord.End_Date__c}"/>
                </apex:column>
                <apex:column headerValue="Pro-Bono" width="10%">
                    <apex:outputText value="{!IF(clientRecord.Pro_Bono__c, 'Yes', 'No')}"/>
                </apex:column>
            </apex:dataTable>

 


Thanks,

Sanjeev