• jwetzler
  • PRO
  • 3393 Points
  • Member since 2006

  • Chatter
    Feed
  • 129
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 865
    Replies

How can I get the visualforce's date picker interface to work without setting standardStylesheets to true?

 

The standardStylesheets attribute of <apex:page> controls whether prebuilt visualforce css files will be included in the page. The way I understood it, it would not remove funtionality (html and javascript), but only enhance the way the page looks.

 

A page with standardStylesheets="true" (the default setting) and a date input field, has a calendar datePicker interface appear when someone clicks in the field. Changing standardStylesheets="false" results in a loss of this feature. This behavior happens even if there are no css styles applied.

 

I could use some help. I'm hoping that this is not a bug.

 

 

I have a lookup field in contact to the user object.  For each user, I have a contact record as well.  I'm trying to create a VF page that will automatically pull the contact record of the current logged in user.

 

I'm still fairly new to VF, but so far I have created a class called "mycontact":

 

public class MyContact{
    
    private final Contact contact;
    
    public MyContact(){
        contact = [ select id from Contact where user__c = :UserInfo.getUserID()];
        }
        
    public Contact getContact() {
        return contact;
        }
 }

 

The question now is how do I write up the VF page to use this info and render the contact info automatically?  I will be using this VF page in a overridden tab.

 

I used something like this, but it requires me to click on it to show the info:

<apex:page Controller="MyContact" >
<apex:outputlink value="/apex/mycontact"> Click Here <apex:param name="id" value="{!contact.id}"/> </apex:outputlink>
<apex:detail />
</apex:page

 

Any help to a newbie would be greatly appreciated.  Thanks.

  • March 02, 2012
  • Like
  • 0

 

hi all,

 

i have a custom object. while creating each and every new fields in that object, i have added some lines in the Help Text (to get displayed in the UI, detail page and in edit page as well). while creating or editing or viewing the details page, the question mark (?) near every field describes about it. (i.e,.) working as it is.

 

now, i have created a visualforce page and i have overridden the new record creation page and edit page of that object. In that VF page, i have referred the fields from the custom object only (using inputField component). My problem is, i am not getting that help text (?) in my VF page, while creating a new one and editing the existing one too. how to bring the help text (?) near every field in my VF page... please help me.. 

 

 

thanks, 

abivenkat,

SFDC Learner

I use it all the time,

 

BUT WHY.....

 

Why declare a method to return type PageReference and then return NULL.....

 

Sorry for the newb question.........

ive had success a few times in creating pages and controllers so that their name showed up in the visualforce content dropdown

but this last time, im just not sure why i can use the following for a list button, but nothing else

 

page:
<apex:page standardcontroller="[controller a]" recordSetVar="[vf name]" tabstyle="[tab name]" extensions="[custom controller">

controller:
public class [custom controller] {

    public [custom controller](ApexPages.StandardSetController controller){

when i go to [controller a] object and try to create a custom button, i can only create a list button. but i want to override a page to this visualforce page, namely the view url. however the visualforce content dropdown box is empty

 

how do you get that content dropdown to populate?

Hi,

in my VF page, i've the following code:

<apex:repeat value="{!ad.groupCafAdvList}" var="groupadv">
	
	<apex:outputPanel id="groupOptions" layout="block" rendered="true">
		<apex:inputCheckbox style="width:20px;" id="group_Chk" value="{!groupadv.selected}" >
			<apex:actionSupport event="onchange" rerender="{!$Component.groupOptions}" /></apex:inputCheckbox>
		<apex:outputText value="{!groupadv.name}" />
		
		<apex:outputPanel id="groupcontent" layout="block" rendered="{!groupadv.selected}">
			content<br />
			content<br />
			content<br />
			content<br />
		</apex:outputPanel>
	</apex:outputPanel>
</apex:repeat>

 and it works, but normally i would like to rerender only the outputPanel with id "groupcontent" (the embedded one).

 

I don't understand why I've to rerender the embedding outputPanel.

 

Can anybody explain it to me ?

 

Thanks

  • August 26, 2011
  • Like
  • 0

I'm trying to create PDF page and getting a strange text showing at the bottom of the page.

I'm very new to coding...

 

Can anyone tell me why I'm getting these text and how to fix?

 

the strange text is;

"JanuaryFeburaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember

2010201120122013201420152016

MonTueWedThuFriSatSun

 

Today"

 

and my code is:

<apex:page renderas="PDF" standardController="Opportunity">
<html>
<head>
  <style> 
     interger counter =0;
     body {font-family: Arial Unicode MS; FONT-SIZE:13px} 
     @page{
     size: portrait;
     @top-right {
        fnt-family:sans-serif;
        font-size:80%;
        content: "Page " counter(page)  " of " counter(pages);
    }
    }   
    .header{
    font-reight:bold;
    font-size:20px;} 

  </style>
 </head>

 <body>
<center>
<apex:outputtext value="TMU SALES ORDER REPORT" styleclass="header" />
<hr/>
</center>
<apex:form >

<apex:pageBlock >
    <apex:pageblocksection title="Customer Information" columns="2" >
    <apex:outputtext value="Customer Install Address" styleclass="header" />
    <apex:outputtext value="Invoice Address" styleClass="header" />
    <apex:outputField value="{!Opportunity.AccountID}" />
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Account.shippingStreet}" />
    <apex:outputfield value="{!opportunity.Account.billingStreet}" />
    <apex:outputfield value="{!opportunity.Account.shippingCity}" />
    <apex:outputfield value="{!opportunity.Account.billingCity}" />
    <apex:outputfield value="{!opportunity.Account.shippingState}" />
    <apex:outputfield value="{!opportunity.Account.billingState}" />
    <apex:outputfield value="{!opportunity.Account.shippingPostalCode}" />
    <apex:outputfield value="{!opportunity.Account.billingPostalCode}" />
    <br/>
    <b>    If Ship to Address is not Install Address: </b>
    <br/>
    <apex:outputtext value=""/>
    <apex:outputfield value="{!opportunity.Machine_Ship_To__c}" style="width:300px" />
    </apex:pageblocksection>
    <hr/>
         <apex:pageblocksection title="Contact Information" columns="2">
         <apex:outputfield value="{!Opportunity.Customer_Contact__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Phone}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Direct_Phone__c}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.FAX}"/>
         <apex:outputfield value="{!Opportunity.Customer_Contact__r.Email}"/>
     </apex:pageblocksection>
  <hr/>
</apex:pageblock>
</apex:form>

<apex:pageblock >
    <apex:pageBlockSection >
    <apex:relatedList list="OpportunityLineItems"/>
    </apex:pageBlockSection>
</apex:pageblock>

</body>
</html>
</apex:page>

 Thanks.

 

  • August 11, 2011
  • Like
  • 0

Is there any way to get the Id of an apex:tab component or any component inside an apex:tab using $Component ?

I'm getting an empty string for some reason. This is the way I'm using it at the moment:

<apex:form id="theForm">
	<apex:tabPanel switchType="client" id="theTabPanel">
		<apex:tab label="A Tab" name="atab" id="theTab">
			<apex:outputPanel id="testField">test</apex:outputPanel>
		</apex:tab>
	</apex:tabPanel>
</apex:form>

{!$Component.theForm.theTabPanel.theTab.testField}

 The string is empty if I try to reference either a tab or anything inside a tab, has anyone run into this?

 

Thanks in advance.

I am currently limited to showing 20 rows on a pageBlockTable I have created in Visualforce.

Is there a way to increase this limit without creating a controller extension? I'm running professional edition.

Hello, I have created a VisualForce page that calls an SSQL statement and displays the records in my database. All my fields are displaying correctly, except my "Owner" field, which is a user lookup.

 

On this field, the User ID is displaying instead of the User name.

 

For example, I am seeing:

Owner

00530000004FXC5AAO

00530000004FYJJAA4

 

when I really want to be seeing

Owner

Steve Perry

Leroy Jenkins

 

 

My The object API for Owner is called: Owner__c. Do I need to attach an attribute to this in order to see the user's name rather than their ID?

Can anybody tell me why this is the case, or is it just a compiler bug?

 

This line fails during compile with the error

 

         <apex:column headerValue="XXX" value="{!if(rel.Child__c==null,'Contact','Child')}"/>

 

Save error: Syntax error.  Missing ')'.

 

(rel.child__c is a valid object, valid field, etc. that's not the problem.  )

 

If I change rel.child__c to a constant value, it compiles correctly.  (albeit it's sort of a meaningless thing to do)

If I leave rel.child__c in place and remove the header_value='XXX', it compiles correctly.

Lastly, if I change the line to:

 

         <apex:column headerValue="XXX" value="{!if(rel.Child__c==null,'Contact','Child')}PEANUTS"/>

 

it compiles correctly.  It doesn't have to be "PEANUTS", adding anything, even a space let's it compile.

 

Clearly there's something wrong.  And, regardless, it's a really bad error message.   I'd file a bug but I wonder if someone has a logical explanation like it does something when evaluating the Value that's different depending on if it's within a formula or without, etc.  Strange.

 

Best, Steve.

 

Hi there,

 

I'm having this error on my VF page and can't  get it resolved. here is the class and page:

 

 

    TAsk[] tsk = [select subject, who.name, status, type, activitydate, what.name FROM Task WHERE WhoID IN ( SELECT Contact__c FROM Leadership_position_code__c WHERE Position__c = 'President') and OwnerID = :UserInfo.getUserId()];
    return tsk;

 

<apex:page controller="Taskleader" showHeader="false" >
<apex:form >
<apex:pageBlock id="pageBlock" Title="Tasks with Presidents">
<apex:pageBlockTable value="{!tsk}" var="tskL" rendered="{!NOT(ISNULL(tsk))}">
<apex:column headerValue="Name" ><apex:outputLink value="https://cs2.salesforce.com/{!tsk.Who.id}" target="_parent">{!tsk.Who.Name}</apex:outputLink></apex:column>
<apex:column value="{!tsk.subject}"></apex:column>
<apex:column value="{!tsk.type}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Thanks!

 

I'm having an issue with what I believe is VF trying to interploate JavaScript. For example, given this JavaScript embedded in a VF page:

 

 

html += "<input type='checkbox' id='plVal" + val + "' value='" 
+ field.picklistValues[val]+ "'/> " + field.picklistValues[val] + "<br/>";

 This is output by VF:

 

html += "<input id="plVal&quot; + val + &quot;" type="checkbox" value="&quot; 
+ field.picklistValues[val]+ &quot;"/> " + field.picklistValues[val] + "<br/>";

notice that VF has apparently identified the <input> which is inside a JS string. It swapped the order of the id and type attributes, and screwed some stuff up. 

 

How can I prevent this? I tried the old trick surrrounding the JS code w/ html comments (<!-- -->), but VF outputs nothing but asterisks for the JS code. 

 

Any idea how to prevent this, besides moving JS to an external file?

 

 

Hi,

 

I am unable to get this to work.

I am trying to render a pageblock based on the selection of the picklist value. if the Opportunitystage=='Qualification' i want to then render the close date field.

in the below code i want to display the Closedate only when an Opportunity stage is selected and equals to "Qualification"

I don't know if i am doing any AJAX requests incorrectly.Can any one help me with this.

 

Page:

<apex:page standardController="Opportunity">
  <apex:form >
    <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit">
   
      <apex:pageBlockButtons location="bottom" >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>               
      </apex:pageBlockButtons>

    <apex:pageBlockSection columns="1">
      <apex:inputField value="{!opportunity.name}"/>
      <apex:pageBlockSectionItem >
      <apex:outputLabel value="{!$ObjectType.opportunity.fields.stageName.label}" 
                        for="stage"/>
      <!-- 
           Without the actionregion, selecting a stage from the picklist would cause 
           a validation error if you hadn't already entered data in the required name 
           and close date fields.  It would also update the timestamp.
      -->  
    
      <apex:actionRegion renderRegiononly="{!opportunity.stageName !='Qualification'}" >
        <apex:inputField value="{!opportunity.stageName}" id="stage">
          <apex:actionSupport event="onchange" rerender="ajaxrequest"
                              status="status"/>
          </apex:inputField>
          </apex:actionRegion>
      </apex:pageBlockSectionItem>
        
       
        </apex:pageBlockSection>
        
          <apex:outputPanel id="ajaxrequest" rendered="{!Opportunity.StageName}" > 
              <apex:inputField value="{!Opportunity.CloseDate}"/>
             {!text(now())}
          </apex:outputPanel> 
        
      </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks,

Sales4ce

Hello all,

 

I am writting a visual force page for the task object, to display some activitives in a different page based on the Subject.

 

This is the error i am getting with my code. Can anyone point me in the rigth direction please:

Error: Compile Error: Illegal assignment from LIST<Task> to LIST<Task> at line 19 column 4

 

 

 

public class MarketingGeniusTasksController
{
       List<Task> tk;
 
 public MarketingGeniusTasksController(ApexPages.StandardController Controller)
   {
 }
 
  Public List<Task> getResults()
  {     
        return tk;
  }
 
 public PageReference gettk()
 {
   String userId=UserInfo.getUserId();
   UserId=userId.Substring(0,15);
   System.debug('UserId=='+UserId);
   tk=[Select Status, Subject, Priority, OwnerId, Owner.Name, WhatId, What.Name, WhoId, Who.Name, Vmail__c, RecordTypeId, LastModifiedDate,   from Task where Subject='Enterprise Marketing Genius Email'];   --> Line 19 error
   return Null;
 }

    Static testMethod void testMarketingGeniusTasksController()
    {
    user testUser=[Select Id from user where ProfileId='00e30000000eFWd' AND IsActive=true Limit 1];
    ApexPages.StandardController sc = new ApexPages.StandardController(testUser);
    System.RunAs(testUser)
     {
      MarketingGeniusTasksController testMGT = New MarketingGeniusTasksController(sc);
      testMGT.gettk();
      testMGT.getResults();
     }  
    }
 }

 

  • February 17, 2011
  • Like
  • 0

hi everyone,

this is really simple.. yet i am lost!

 

I want to pass 2 values from 2 different selectLists in VF to an Apex class. I've found all kinds of stuff online about populating a selectList with data from an Apex class... but nothing about passing a parameter from VF to Apex.

 

My VF code is below. Once I have the 2 variables in Apex, I will use them in my SOQL WHERE clause.

 

thanks in advance!

 

-----------------

<apex:page standardController="Deposit__c" extensions="updatepledges">
<apex:form >  
First Date to include:
<apex:selectList id="first" size="1" >
            <apex:selectoption itemLabel="First of month" itemValue="1"></apex:selectoption>
            <apex:selectoption itemLabel="Second of month" itemValue="2"></apex:selectoption>
            <apex:selectoption itemLabel="Third of month" itemValue="3"></apex:selectoption>
            <apex:selectoption itemLabel="Fourth of month" itemValue="4"></apex:selectoption>
  // ... the list continues like this...
            <apex:selectoption itemLabel="Thirty first of month" itemValue="31"></apex:selectoption>
</apex:selectList>  


Last date to include:
<apex:selectList id="last" size="1" >
            <apex:selectoption itemLabel="First of month" itemValue="1"></apex:selectoption>
            <apex:selectoption itemLabel="Second of month" itemValue="2"></apex:selectoption>
            <apex:selectoption itemLabel="Third of month" itemValue="3"></apex:selectoption>
            <apex:selectoption itemLabel="Fourth of month" itemValue="4"></apex:selectoption>
  // ... the list continues like this...
            <apex:selectoption itemLabel="Thirty first of month" itemValue="31"></apex:selectoption>
</apex:selectList>
<apex:commandButton action="{!runpledges}" value="Submit" />

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

I have an error with a new Visualforce page I'm creating that takes advantage of a custom controller I made. It is all around custom objects I build, and the class file compiled just fine. But when I start building the Visualforce page it gives me an error that I can't for the life of me figure out.

 

This is the Visual Force Page

 

 

<apex:page controller="TaskTimeEntryController" showHeader="true" sidebar="false">
	<apex:form id="TimeEntryForm">
		<apex:pageBlock >
			<apex:pageBlockSection >
				{!$User.FirstName} {!$User.LastName}
			</apex:pageBlockSection>
			<apex:pageBlockSection >
				<apex:pageBlockTable value="{!lstTasksForUser}" var="lstTasks" width="100%">
					<apex:column HeaderValue="Select">
						<apex:outputText Value="{!lstTasks.Name}"></apex:outputText>
					</apex:column>
				</apex:pageBlockTable>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

And the Controller:

 

public class TaskTimeEntryController {
	public List<Task__c> lstTasksForUser = new List<Task__c>();
	public List<Time_Entry__c> lstTimeToEnter = new List<Time_Entry__c>();
	
	public TaskTimeEntryController(){
		populateTaskList();
	}
	
	private void populateTaskList() {
		lstTasksForUser = [
			Select Name, Task_Status__c, Current_Hours__c, Current_End_Date__c, Current_Duration__c, Assigned_To__c, 
				(Select Estimated_Time__c From Future_Time_Entries__r)
			From Task__c 
			WHERE Assigned_To__c = :UserInfo.getUserId()];
	}
	
	public List<Task__c> getUsersTasks() {
		return lstTasksForUser;
	}
}

 

 

The class compiles fine, I'm using the Force.com IDE, so that seems to be okay. But then when I go to save my Visualforce page it gives the following error:

 

Save error: Unknown property 'TaskTimeEntryController.lstTasksForUser'

 

I've looked over a the variable names a bunch of times and even copied another sample that was the same structure and it compiles just fine, but when I change to my objects, error. I'm sure I'm missing something simple.

  • February 14, 2011
  • Like
  • 0

Hi All -

 

I am new, so please forgive my green - but I am having a perplexing problem in generating a Visual Force email template showing related lists for a custom object.

 

I CAN get a list of Cases related to an Account with no problem, but when I put in a custom object  (Child Relationship Name "Suppliers") which is also (Master-Detail) related to Account I get the following error: Error: Invalid field Suppliers for SObject Account

 

I have tried everything I can think of - using API name instead, appending "__c" to the end, but it seems that i can't make any lists at all with custom objects in this code.

 

Is there a restriction within this type of code that allows only lists with standard objects or is there something I'm missing?

 

Any help would be greatly appreciated. I am not good enough to make a custom Apex controller yet and a little under the gun to kluge something together.

 

Thanks much,

 

Lex

 

Below is relevant code:

 

 

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Account"
    subject="Supplier report for Account: {!relatedTo.name}"
    replyTo="support@acme.com" >
<messaging:htmlEmailBody >   
<html>
    <body>
     <STYLE type="text/css">
           TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
           TD  {font-size: 11px; font-face: verdana }
           TABLE {border: solid #CCCCCC; border-width: 1}
           TR {border: solid #CCCCCC; border-width: 1}
     </STYLE>
         <font face="arial" size="2">
      <p>Dear {!recipient.name},</p>
      <p>Below is a list of supplier records related to the account: {!relatedTo.name}.</p>
<table border="0" >
        <tr >
            <th>Action</th><th>Product</th><th>Status</th><th>Creator Email</th><th>BL date</th>
         </tr>
<apex:repeat var="cx" value="{!relatedTo.Suppliers}">
   <tr>
       <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |  
       <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
(...snip...)

 

 

I have been bashing away at this without success all day and obviously am missing something.  I have a VF page which shows a list of custom objects called Lead Companies, which we use to tie leads from the company together. When a user clicks on one of the lead companies in the list, it displays a list of related leads in another pane (a table cell) on the page.  This works perfectly.

 

When clicking on one of leads, I want to open a new window with the standard salesforce lead detail view.  That way, I don't need to code the page and if there are permissions issues (my page needs to run in system mode), it will be taken care of. 

 

I use a Javascript function to pop up the window.  This works fine from a different part of the page which does something similar (but not the same) for accounts.  However, with the lead, it does not appear to run the setter to get the lead id from the param tag until AFTER calling the Javascript function.  From reading all the docs I can find, it should work.  However I know from previous experience that I must be missing something that will be obvious to those casting a fresh eye over this, so thanks in advance.

 

Javascript function - the alert shows a blank AnyId although the debug log shows that the setter is being called, but it only shows up in the log AFTER I've pressed OK on the alert:

 

<script type="text/javascript">
  function pop(AnyId) {
    var myWindow;
    alert('Id is '+AnyId);
    myWindow = window.open('/'+AnyId,'','width=550,height=550,scrollbars=yes');
  }
 </script>

 Relevant part of Visualforce page:

 

<apex:pageBlock title="Leads in Lead Company" id="leadDetails">    <apex:pageBlockTable value="{!relatedLeads}" var="leads">	    
  <apex:column headerValue="Name"> 
    <apex:commandLink value="{!leads.Name}" onclick="pop('{!LeadId}');" > 
      <apex:param name="LeadId" value="{!leads.Id}" assignTo="{!LeadId}" />
    </apex:commandLink>                
  </apex:column> 
... other columns ...
</apex:pageBlockTable>
</apex:pageBlock>

Controller code:

 

  public String LeadId { 
    get ;
    set {
      LeadId =  '/'+value; 
system.debug('### in LeadId setter: LeadId is '+LeadId);  	 	 
  	}
  } 

If anyone could tell me what I'm doing wrong I'd be very grateful. 

 

 

 

 

  • January 28, 2011
  • Like
  • 0

Hi Friends,

 

As far as I know from this forum,constructor gets fired as soon as browser loads the page.If that is correct then I should be able to invoke getgreetings getter method and see greeting message .However,I get an error message

 

System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Account.Name.

 

My question is if the constructor has been executed when the page has been loaded then I should be able to invoke grettings getter method and see results.

 

As per me constructor has retreived account record in the current context and passed it to the acct variable and then I am accessing the name field in the getter method.But when I invoke getter method in the visual page then I get the above exception.Why.Your suggestions are most welcome   

 


 

 

public class myControllerExtension {

    private final Account acct;
    
    // The extension constructor initializes the private member  
    
    // variablae acct by using the getRecord method from the standard  
    
    // controller.  
    
    public myControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }

    public String getGreeting() {
        return 'Hello ' + acct.name + ' (' + acct.id + ')';
    }
}

 

 

 

 

<apex:page standardcontroller="account" extensions="mycontrollerextension" >

 

 I have invoked the greeting getter method by invoking{!greeting}; 

 

</apex:page>

 

 

 

 

 

 

 

  • January 27, 2011
  • Like
  • 0

The Salesforce.com documentation team is currently looking for ways to combine reference material across several Force.com technologies--like the API, Apex, and Visualforce--into a single guide. The goal is to ease developers from the burden of switching between two or even three guides when trying to work on a project.

 

If you had to choose, what information about the Force.com platform would you like to see added to the Visualforce guide? Some examples include:

 

  • Reference material from the API on standard objects and their fields
  • A list of SOSL and SOQL calls that can be used in custom controllers
Message Edited by jwetzler on 01-12-2010 11:41 AM

im trying to pass parameters to my controller. But not luck so far. i have tried putting the values in an outputpanel and rerendering the panel and still its not passing the values.

 

<apex:column id="feedColumn" >
             
                                        
                 <apex:facet name="header">Feeds</apex:facet>
                 
                    
            	 <apex:param name="FeedId" value="{!feed.feedId__c}" assignTo="{!commentId}"></apex:param>
            	 
            	   
                        <apex:outputPanel styleClass="invisiblePanel" id="jsvalues">
                             <apex:outputText value="Value one: {!feed.feedId__c}" /><br/>
                             <apex:outputText value="Value two: {!commentBody}" /><br />
                             <apex:outputText value="Value three: {!feedLikeId}" /><br /> 
                              <apex:outputText value="Value four: {!commentId}" /><br />             
                      </apex:outputPanel>
                 
                                 
                    
                  
                    <apex:form id="commentForm" >
                        
                        <apex:outputLabel id="like" style="padding-right:20px;color:#0000FF;" value="Like" onclick="changeLike('{!$Component.chatterFeed.feedTable.commentForm.like}')"  >
                         
                          <apex:actionSupport event="onclick" action="{!mobileLike}" reRender="jsvalues">
                           <apex:param id="feedLikeId" value="{!feed.feedId__c}" assignTo="{!feedLikeId}" name="feddLikeid"></apex:param>
                          </apex:actionSupport>
                        </apex:outputLabel>                        
                      
                     
                        
                    </apex:form>
                    
              </apex:column>

 

 

I have a VF page that is being populated via a standard controller and a extension. It works just fine in the sandbox, but in production I am recieving the following error: " PDF generation failed. Check the page markup is valid. "

 

Any input on why this is happing would be appreciated:

 

edit: I have determined it has to do with the public case comments rendered. It works if I just have the comment body rendered as public, but if I add the created date as well then the error arises.

 

Page:

 

<apex:page renderas="pdf" standardController="Case" extensions="PDFServiceExtension">
<apex:stylesheet value="{!$Resource.PDFHeaderFooter}"/>
<center>
    <apex:image url="{!$Resource.MIRLetterhead}" width="700" height="97" />
</center>
    <apex:panelGrid columns="2" id="theGrid">
        <apex:outputLabel value="Case #: " for="Case#" style="font-weight: bold"/>
        <apex:outputField value="{!Case.CaseNumber}" id="CaNumber"/>
        
        <apex:outputLabel value="Date & Time Opened: " for="CaseOpen" style="font-weight: bold"/>
        <apex:outputField value="{!Case.CreatedDate}" id="CaseOpen"/>
        
        <apex:outputLabel value="Date & Time Closed: " for="CaseClosed" style="font-weight: bold"/>
        <apex:outputField value="{!Case.ClosedDate}" id="CaseClosed"/>
        
        <apex:outputLabel value="Status:" for="CaseStatus: " style="font-weight: bold"/>
        <apex:outputField value="{!Case.Status}" id="CaseStatus"/>
        
        <apex:outputLabel value="Type:" for="CaseType: " style="font-weight: bold"/>
        <apex:outputField value="{!Case.Type}" id="CaseType"/>
        
        <apex:outputLabel value="Account: " for="Name" style="font-weight: bold"/>
        <apex:outputField value="{!Case.Account.name}" id="Name"/>
        
        <apex:outputLabel value="Subject: " for="Case#" style="font-weight: bold"/>
        <apex:outputField value="{!Case.Subject}" id="CaSubj"/>
        
        <apex:outputLabel value="Description: " for="Case#" style="font-weight: bold"/>
        <apex:outputField value="{!Case.Description}" id="CaDesc"/>

    </apex:panelGrid>
    
    <br></br>
    <apex:outputLabel value="Service Activities:" for="Name" style="font-weight: bold"/>
    <apex:dataTable value="{!SA}" var="LIs" width="50%" border="1px" >
		<apex:column headerValue="Service Engineer" value="{!LIs.Contact__c}" headerClass="tableHead"/>
		<apex:column headerValue="Total Hours" value="{!LIs.Total_Hours__c}"/>
		<apex:column headerValue="Date Performed" value="{!LIs.Date_Performed__c}"/>
	</apex:dataTable>
	
	<br></br>
    <apex:outputLabel value="Case Comments:" for="Name2" style="font-weight: bold"/> 

    <apex:pageBlock >
        <apex:pageBlockTable value="{!case.casecomments}" var="c" width="50%" border="1px" >
            <apex:column value="{!c.commentbody}" rendered="{!c.isPublished = true}"/>
            <apex:column value="{!c.createddate}" rendered="{!c.isPublished = true}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>   
</apex:page>

 Extension:

public with sharing class PDFServiceExtension {
	
	private final Case Ca;
  
	public PDFServiceExtension(ApexPages.StandardController CaseController) {
		this.Ca = (Case)CaseController.getRecord();
	}
  
	//For Testing Purposes  
	public PDFServiceExtension(Case tcase) {
        this.Ca = tcase;
	}
  
  // Create a list of type Suite__c and call the query method
    public List<Service_Activity__c> activityRecords() {
         return (List<Service_Activity__c>) activityRecords.getRecords();
    }
    
  // Query the db for the list of Suite__c records to use on the vf page and return a list
    public ApexPages.StandardSetController activityRecords{
      get {
            if(activityRecords == null) {
                activityRecords = new ApexPages.StandardSetController(Database.getQueryLocator([Select s.Contact__c, s.Case__c, s.Total_Hours__c, s.Description__c, s.Date_Performed__c  from Service_Activity__c s Where s.Case__c =:ApexPages.currentPage().getParameters().get('id')]));
            }
            return activityRecords;
        }
        set;
    }
    
    public List<Service_Activity__c> getSA() {
        return (List<Service_Activity__c>) activityRecords.getRecords();
    }
}

 

Hi All

 

For one of my client, I am trying to display the Polish font on the PDF attachment. I have hardcoded all their font(text) in the component and used that inside the email tempalte. But the template is not printing the some of the polish font.

 

For Example :

 

sprzeday should be displayed like sprzedaży

Imi i Nazwisko should be displayed like Imię I Nazwisko

 

This is very urgent. Any examples will be highly appreciated.

 

Thanks in Advance


 

Hi All,

I have seen this method used a couple of times, but no standard doc exists to explain it. Searched for it in the controller methods in standard salesforce documentation, but nothing.

Can anyone please shed an idea of what the controller method, getSubject does and how it works.

Thank you 

  • June 29, 2012
  • Like
  • 0

I need to rerender based on the multiselct picklist values. It is working fine if only one value is selected, but if more than one value is selected in the multi-picklist field, only the first value is being getting the response. Please Help.

 

*****************Visualforce page part ************************ 

<apex:pageBlockSection columns="1" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Programs user needs access to" for="apps" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Citrix_Applications__c}" onselect="populateRoles()" onChange="populateRoles()" id="apps" onkeypress="return disableEnterKey(event)"/>
<apex:actionFunction immediate="true" name="populateRoles" action="{!getAppRoles}" rerender="Rolesr" status="reqstatus" focus="name"/>
<script> var rname = document.getElementById("{!$Component.apps}"); </script>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionRegion >
<apex:pageBlockSection columns="1" id="Rolesr" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Security Role" for="RolesA" />
<apex:outputPanel styleClass="requiredInput" layout="block">
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputField value="{!Case.Role__c}" id="RolesA" />
<script> var rem = document.getElementById("{!$Component.RolesA}"); </script>
<apex:actionStatus id="reqstatus" startText="fetching the relevant info.." />
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageblocksection>
</apex:actionRegion>

 

 

********************** Controller method **********************************

public void getAppRoles() {
String autoroles='';
// String id=ApexPages.currentPage().getParameters().get('j_id0:_form:j_id32:j_id45:j_id58:j_id59:ISTEmail');
String[] id=ApexPages.currentPage().getParameters().get('pg:_form:j_id31:j_id57:j_id64:j_id65:apps').split(';');
System.debug('======32323200000000000000===>'+id);
for (String i : id){
System.debug('======iiiiiiiiiiiiiiii===>'+id);
if(i == 'ADAPT') {
autoroles= autoroles +' PRS Update, ADAPT Update';
}if(i == 'ARTS1') {
autoroles= autoroles +' PRS Update';
}if(i == 'ARTS2') {
autoroles= autoroles +' PRS Update';
}if(i == 'MPS') {
autoroles= autoroles + ' MPS Update';
}if(i == 'PRS') {
autoroles= autoroles + ' PRS Update';
}
}
req.Role__c = autoroles;

}

 

 

 

 

Notes: Here "Citrix_Applications__c" is a multiselect Picklist field and "Role__c" is a text field which needs to auto-populate the text based on the Citrix_Applications__c values.

 

 

Thank You

How can I get the visualforce's date picker interface to work without setting standardStylesheets to true?

 

The standardStylesheets attribute of <apex:page> controls whether prebuilt visualforce css files will be included in the page. The way I understood it, it would not remove funtionality (html and javascript), but only enhance the way the page looks.

 

A page with standardStylesheets="true" (the default setting) and a date input field, has a calendar datePicker interface appear when someone clicks in the field. Changing standardStylesheets="false" results in a loss of this feature. This behavior happens even if there are no css styles applied.

 

I could use some help. I'm hoping that this is not a bug.

 

 

I have a div statement that I can't seem to get to work properly.  If the checkbox isn't checked it is still displaying the table, but not "Estimated Labor Hours" line.   I'm sure it's something simple, but I can't seem to figure it out

 

<div style = "{!IF(Contract.Display_Labor_Hours_Table__c == true, '', 'display:none;')}">
<b>Estimated Labor Hours:</b><br />

<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<th align="left"><b>Labor Category</b></th>
<th align="left"><b>Hours</b></th>
<th align="left"><b>Hourly Rate</b></th>
<th align="left"><b>Category</b></th>
</tr>
<tr>
<td>Architect</td>
<td>{!ROUND(Contract.Total_Estimated_Architect_Labor_Hrs__c,0)}</td>
<td><apex:outputField value="{!Contract.Architect_Hourly_Rate__c}"/></td>
<td><apex:outputField value="{!Contract.Total_Architect_Labor_Cost__c}"/></td>
</tr>
<tr>
<td>Consultant</td>
<td>{!ROUND(Contract.Total_Estimated_Consultant_Labor_Hrs__c,0)}</td>
<td><apex:outputField value="{!Contract.Consultant_Hourly_Rate__c}"/></td>
<td><apex:outputField value="{!Contract.Total_Consultant_Labor_Cost__c}"/></td>
</tr>
</table></div><br />

 

I've just read about a dozen posts on this issue but none of the solutions work for me. Parameters simply are not passed when the commandButton or commandLink is inside a pageBlockTable. The exact same commandLink code works outside the table (see below).

 

  <apex:form >
<apex:pageBlock >
<apex:commandlink value="Connect(123)" action="{!selected}"> <apex:param name="customer" value="123"/> </apex:commandlink>  
<apex:pageBlockTable value="{!matches}" var="i" id="theTable" styleClass="tableClass">
<apex:column >
<apex:commandlink value="Connect(333)" action="{!selected}">
<apex:param name="customer" value="333"/>
</apex:commandlink>
... 

If you click the top link, the selected action is fired with the customer parameter set to 123.

 

If you click the link inside the column of the pageBlockTable no action is fired.

I'm not sure how to get my page to appear as a standard page layout visualforce insert. When accessing the page normally via url (/apex/page?rfpId=<record id>) it works fine. However when accessing via the salesforce url (naX.salesforce.com/<record ID>) the page layout insert errors "Content cannot be displayed: List has no rows for assignment to SObject"

 

I know this is an extension issue, but I'm not clear on where to make my edits so that my standard layout can access my visualforce page. 

 

The record where the VFpage Insert (Standard Layout) is, is the record ID that needs to be passed. I know it has something to do with getRecord(); but I'm not sure where to apply it.

 

EDIT: Ah, I need to add that this Page is rendered as a PDF.

 

Proposal Extension:

 

public with sharing class ProposalExtension {

    public String rfpId = ApexPages.currentPage().getParameters().get('rfpId'); 
    private final Proposal__c p;
    
    //Constructor for ProposalExtension	
    public ProposalExtension(ApexPages.StandardController pCon) {
        this.p = (Proposal__c)pCon.getRecord();
    }
	
	//Proposal used for vendor pages 
    Proposal__c rfp;
	
    public Proposal__c getRFP(){
    	rfp = [SELECT 
	    //Proposal Fields Examples
	    Id, Name, Contracting_Manager_Email__c
	    //Vendor (Contact) Fields Examples
	    Vendor__r.Name, Vendor__r.Account.Name
		
		FROM Proposal__c WHERE Id = :rfpId];	
		
		return rfp;	
    }      

}

 

 Sample VF page content:

Company:<apex:outputField value="{!rfp.Vendor__r.Account.Name}"/><br/>

 

  • April 27, 2012
  • Like
  • 0

The following is defined on a VPage

 

<apex:form>

     <apex:actionFunction name="checkSameAsCustomer" action="{!sameAsCustomer}" rerender="billToSection">
          <apex:param name="checkSameAsParam" assignTo="{!isSameAsCustomer}" value="sameAsCustomerCheck.selected"/>
     </apex:actionFunction>

     <apex:pageBlock>

             :

          <apex:inputCheckbox id="sameAsCustomerCheck" label="Billing same as above" onselect="checkSameAsCustomer" immediate="true"/>

          <apex:pageBlockSection id="billToSection">

             :

 

The inputcheckbox doesn't appear to be invoking the actionFunction.  My controller's implementation of sameAsCustomer writes to the debug log, but nothing shows up.

 

I have tried setting onselect, onchange, and onclick.  Also, as a separate issue the inputcheckbox label never shows either.

 

Thanks in advance.