function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dke01dke01 

An error occurred when processing your submitted information - Custom Controller

I have a page like this

 

<apex:page controller="My_Controller">
<apex:form >
<apex:inputField value="{!foo.bar__c }"/>
  <apex:commandButton value="Search" action="{!search} />
</apex:form > </apex:page>

 

 

And my controller

 

public class My_Controller
{
    public Foo__c foo {get; set;}

    public My_Controller()
    {
        foo = new foo__c();
    }

public PageReference search()
{
return null;
}

}

 

I cannot seem to make a lookup field work on the page.  THe page displays ok, the look up field works.  But when I press the command button I get the error

 An error occurred when processing your submitted information

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Chris JohnChris John

Does it work if you remove the whitespace after bar__c:

{!foo.bar__c }

All Answers

Chris JohnChris John

Does it work if you remove the whitespace after bar__c:

{!foo.bar__c }
This was selected as the best answer
dke01dke01

Unbelievable - yes it now works

1) I cannot believe I did not try this myself
2) I cannot believe visualforce doesn't trim the string automatically for me.

ColinKenworthy2ColinKenworthy2

Unbelievable, I had same problem and wasted a few hours on it. Eventually found the answer here.

I too cannot understand why a trailing space at the end of the expression makes a difference. Why doesnt the compiler trim this?

Mason StaerkelMason Staerkel
Out of this world! I have been searching for this solution for hours and it was a space before the end Quote mark for me. Thank you for pointing out the obvious, yet amazingly easy to miss, resolution.