Following is my VF page:

<apex:page standardController="Case" extensions="ctrlClaim"> 
            background-color: white; 
            border-style: solid;
            border-color: #1797c0;
            border-width: 2px;
            left: 50%;
            position: absolute; 
            z-index: 9999;
            /* These are the 3 css properties you will need to tweak so the pop 
            up displays in the center of the screen. First set the width. Then set 
            margin-left to negative half of what the width is. You can also add 
            the height property for a fixed size pop up.*/
            width: 500px;
            margin-left: -250px;

  <apex:form >

    <apex:pageBlock title="Case Detail">

      <apex:PageMessages escape="false"/>

        <!-- Selection PopUp -->
           <apex:outputPanel id="popup">
             <apex:outputPanel styleClass="customPopup" rendered="{!displayPopUp}">
                 <apex:pageBlock > 
                    <apex:pageBlockButtons location="bottom">
                     <apex:actionRegion >
                       <apex:commandButton value="Select" action="{!closePopUp}"/>  
                       <apex:commandButton value="Cancel" action="{!closePopUpCancel}"  rerender="popup"/>   
                    <apex:pageBlockSection title="Production Order Number Selection" collapsible="false" columns="3">                             

                         <apex:pageBlockSectionItem >
                            <apex:selectList value="{!ProductionOrderNumber}" multiselect="false" >
                                <apex:selectOptions value="{!ProductionOrderNumbers}"/>                          
                         <apex:pageBlockSectionItem />
        <!-- end PopUp -->

         <apex:outputtext value="{!case.Loading_ID__c}" rendered="false"/>
        <apex:pageBlockSection title="Order Information"  columns="3">    
            <apex:inputfield value="{!case.Loading_ID__c}" id="loadingID"/>       
            <apex:commandButton action="{!FindProductionOrderNumber}" image="/img/func_icons/ispan12.gif" title="Search Production Order Numbers" immediate="true" rerender="popup"/>            


Apex controller:

public class ctrlClaim {
    public Boolean productCase { get; set; }
    public Boolean locked { get; set; }

    private Case claim;
    private String recordType;
    private String sfdcOverride;
    public String ProductionOrderNumber { get; set; }
    public String InsertedLoadingID { get; set; }
    public List<SelectOption> ProductionOrderNumbers { get; set; }
    public boolean displayPopUp { get; set; }

    public class OrderQueryException extends Exception {}

    public ctrlClaim( ApexPages.StandardController stdCtrl ) {
        claim = ( Case ) stdCtrl.getRecord();
        recordType = ApexPages.CurrentPage().getParameters().get( 'RecordType' );
        sfdcOverride = ApexPages.CurrentPage().getParameters().get( 'sfdc.override' );
        if ( sfdcOverride == '1' && recordType != null ) claim.RecordTypeId = recordType;
        productCase = ( claim.RecordTypeId == Schema.SobjectType.Case.getRecordTypeInfosByName().get( 'Product Case' ).getRecordTypeID() );
        locked = false; 

      public PageReference FindProductionOrderNumber(){
        if (claim.Loading_ID__c!=null){
                if (claim.Loading_ID__c=='1')            
                    ProductionOrderNumbers.add(new SelectOption('1','1'));
                    ProductionOrderNumbers.add(new SelectOption('2','2'));       

        displayPopUp = true;
        return null;

      public void closePopUp(){
        displayPopUp = false;

      public void closePopUpCancel(){
        displayPopUp = false;

      public PageReference ClonePreparation(){
        return null;


Debug: enter image description here Problem is that ,after inserted Loading_ID__c and pressed the button,i get null value for Loading_ID__c in the controller method FindProductionOrderNumber(). Do you know why?

Thanks in advantage for any advice

  • are you getting any value for claim when you debug it in the FindProductionOrderNumber() method ?
    – Rao
    Oct 21, 2014 at 18:58

2 Answers 2


I believe this is your issue - the immediate="true" on the commandButton. Not well-documented in the VF Developer's Guide under the attribute definition, you can see however on this page:

During a postback request, the view state is decoded and used as the basis for updating the values on the page. Note A component with the immediate attribute set to true bypasses this phase of the request. In other words, the action executes, but no validation is performed on the inputs and no data changes on the page.

    <apex:pageBlockSection title="Order Information"  columns="3">    
        <apex:inputfield value="{!case.Loading_ID__c}" id="loadingID"/>       
        <apex:commandButton action="{!FindProductionOrderNumber}" image="/img/func_icons/ispan12.gif" title="Search Production Order Numbers" 
        immediate="true"  <!-- will not send any data to the controller -->

Normally, the immediate="true" is used when you want to leave the page, such as in a cancel operation. So, eliminate the immediate="true" to send the user-entered value in the inputField

See also: https://stackoverflow.com/questions/20685898/salesforce-cant-pass-visualforce-inputtext-values-to-apex-class or

https://stackoverflow.com/questions/1942372/inputfield-databinding-issue-with-visualforce or


BTW - it is very confusing to me that you used merge field case on the VF page but referred to it as claim in the controller.


You are not querying Loading_ID__c as per documentation In your method FindProductionOrderNumber() add this line after system.debug('claim'+claim);:

claim = [select id,Loading__ID__c from case where ID =:claim.id];

After this debug



Note that only the fields that are referenced in the associated Visualforce markup are available for querying on this SObject. All other fields, including fields from any related objects, must be queried using a SOQL expression.

  • How can i query it? I don´t have an ID for the case( creation page)
    – Enry
    Oct 21, 2014 at 19:03
  • I ve tried adding <apex:outputtext value="{!case.Loading_ID__c}" rendered="false"/> but debug log shows even : {RecordTypeId=01220000000JKCKAA4}. The field Loading_ID__c is not added
    – Enry
    Oct 21, 2014 at 19:31
  • you have to do claim.loading__c and make the claim declaration as claim{get;set;}
    – Rao
    Oct 21, 2014 at 20:20

You must log in to answer this question.

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