0

I am trying to show 3 consecutive "blocks/span", 2 are variables, 3rd is a button.

Links to : 1. the element 2. the controller

WITH the last button element, the page DOES NOT save, the error given is :

Error: Could not resolve the entity from <apex:outputField> value binding '{!totalGoodBC}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

WITHOUT the button, the page SAVES, the error is :

value for <apex:outputField> is not a dynamic binding

What is going on here?

3
  • This would be a better question if the relevant parts of the code were pasted in here. Commented Sep 7, 2016 at 16:36
  • I already did. Kindly check the 2nd line, it has the links to the relevant controller and element code.
    – fraglord
    Commented Sep 8, 2016 at 4:28
  • Yes, I see the links. Inline is generally preferred. Commented Sep 8, 2016 at 15:27

2 Answers 2

4

In this scenario, you should use <apex:outputText> instead of <apex:outputField>.

<apex:outputText value="{!totalGoodBC}" styleClass="slds-input"/>

<apex:outputField>is used to bind values which are of Sobject type. Or in other words, instance of Sobject class.

2
  • Perfect :) So I should use outputTEXT for non-SObj variables and outputFIELD only for SObj vars?
    – fraglord
    Commented Sep 8, 2016 at 7:51
  • @fraglord you are correct.
    – Ashwani
    Commented Sep 8, 2016 at 11:35
0

Enter the text to be passed:

public class Sample { public String strText {get;set;} public Sample() { }

public PageReference nextPage() {
    PageReference pg = new PageReference('/apex/NextPage');
    pg.getParameters().put('str', strText);
    pg.setRedirect(false);
    return pg;
}

}

Second VF Page:

Value passed in previous page is {!strText}

public class NextPageController { public String strText {get;set;} public NextPageController() { strText = ApexPages.currentPage().getParameters().get('str'); } } Iam Not Understand Iur Question Can U go to This Link U getting More Info How To Create Custom Button And Standerd Button In VF Pages http://www.infallibletechie.com/search/label/Apex%20and%20Visualforce

1
  • Ah, but I'm not trying to go to the next page. Also, what does getParameters() do?
    – fraglord
    Commented Sep 8, 2016 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .