I am in the process of learning APEX/VisualForce, and I'm working on a VF page that lists out all of the chatter posts from a specific record. Right now, the record that it displays the feed for is hard-coded into the controller like this:

global ConnectApi.FeedItemPage getNewsFeed() {
    return ConnectApi.ChatterFeeds.getFeedItemsFromFeed(null, ConnectApi.FeedType.Record, 'a00E0000006uAuB');

I would like to use an inputField on the VisualForce page where the user can input a record's Id, click a button, and have the outputPanel re-render displaying the given record's feed.

I have the button and the re-render working, but I can't figure out how to pass the value from the inputField to a variable in the controller without it having to have a field on an Object in the database.

Additionally, and in a similar vein, I want the outputPanel to render iff the variable (discussed above) is not equal to null, but again, I can't figure out how to reference either another field on the page or the variable on the controller.

Thanks in advance for any help! If you want to see some more code, let me know. Most of it is taken or adapted from a Connect in APEX tutorial found here.

1 Answer 1


You can use the apex:inputText component http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inputText.htm

<apex:inputText value="{!inputValue}" id="theTextInput"/>

<apex:commandButton action="{!actionMethod}" reRender="theOutputPanel" />

<apex:outputPanel id="theOutPutPanel" rendered="{!inputValue != null}" />....

apex:inputField, as you rightly pointed out, is when you want to directly bind to sObject fields in the controller

As for re-rendering, this one is a great post.

  • Thanks @techtrekker, that definitely gets me halfway there, but I'm still unsure about assigning the value of the inputText field to a variable in the controller. How can I do this? Thanks again! Feb 19, 2013 at 18:21
  • The value="{!inputValue}" is a binding to a controller variable called inputValue. On clicking the button, the controller variable will be populated with the value in the text box on the VF page. Feb 19, 2013 at 18:32
  • I'm getting an error that says Unknown property 'DemoController.filtRecs', despite trying with both of the following in the controller: String filtRecs; AND String filtRecs {get; set;} ... Any idea why I'm getting this error? Thanks! Feb 19, 2013 at 18:52
  • adding 'global' to the front cleared up the error, thanks again! Feb 19, 2013 at 18:59
  • you could also use 'public'. So public String filtRecs { get; set; } Feb 19, 2013 at 19:00

You must log in to answer this question.

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