title: How to get an input value on a Visualforce page from an Apex controller?
body: <p>Let's pretend that I have an <em>sObject</em> called <em>MyCutomObject</em> with the fields <em>Column1</em>, <em>Column2</em>, <em>Column3</em>, <em>PickMeColumn</em> and others. The type of the <em>PickMeColumn</em> is <em>Picklist</em>.</p>
  
  <p>While it's easy to access the object's instance data in my page, I'm a bit stucked with how to get the user's input data from that page to be accessible inside the controller.</p>
  
  <p>Page code:</p>
  
  <pre><code>&lt;apex:page sidebar="false" standardController="MyCustomObject__c" extensions="MyCustomSearchController"&gt;
      &lt;apex:form &gt;
          &lt;apex:pageBlock title="Search Criteria"&gt;
              &lt;apex:pageBlockSection&gt;
                  &lt;apex:inputField value="{!myObject.PickMeColumn__c}" /&gt;
              &lt;/apex:pageBlockSection&gt;
  
              &lt;apex:commandButton value="Search" id="SearchButton" action="{!search}"/&gt;
          &lt;/apex:pageBlock&gt;
  
          &lt;apex:pageBlock title="Search Results"&gt;
              &lt;apex:pageBlockTable value="{!myObjectList}" var="myObject"&gt;
                  &lt;apex:repeat value="{!myObject}" var="aRecord"&gt;
                      &lt;apex:column value="{!aRecord.Column1__c}"/&gt;
                      &lt;apex:column value="{!aRecord.Column2__c}"/&gt;
                      &lt;apex:column value="{!aRecord.Column3__c}"/&gt;
                  &lt;/apex:repeat&gt;
              &lt;/apex:pageBlockTable&gt;
          &lt;/apex:pageBlock&gt;
  
      &lt;/apex:form&gt;
  &lt;/apex:page&gt;
  </code></pre>
  
  <p>Controller code:</p>
  
  <pre><code>public class MyCustomSearchController {
      public MyCutomObject__c myObject {get;set;}
      public List&lt;MyCutomObject__c&gt; myObjectList {get;set;}
  
      public MyCustomSearchController(ApexPages.StandardController controller) {
      }
  
      public PageReference search() {
          String ValueSelectedByUser = '??? Help!';
          myObjectList = [SELECT Column1__c, Column2__c, Column3__c FROM MyCutomObject__c WHERE PickMeColumn__c = ValueSelectedByUser];
          return ApexPages.currentPage();
      }
  }
  </code></pre>