A controller is one piece in the Model-View-Controller (MVC) architecture of Visualforce. A controller can be a standard or custom controller and extensions to controllers can written.

learn more… | top users | synonyms

1
vote
1answer
13 views

Using a custom controller to populate a custom object on Opportunity

Strap in, as this may turn into TL;DR. Within Opportunities, we have created a custom object called Marketing_Support__c. When the 'new' button is clicked it takes you to a page where you can choose ...
2
votes
1answer
49 views

Send Email within Catch inside Constructor

It looks extremely easy, but apparently I can't make this to work. Not even tried: @future, not allowed in contructor create log error object, not allowed in consctructor I tried: inside the ...
1
vote
1answer
32 views

Determining number separator when inputHidden doesn't format a currency number

If I return an object with a currency field, and I'm returning it from a controller. If I use an <apex:inputField>, the number is correctly formatted as 1,234.56. However, if I use an ...
6
votes
4answers
203 views

How do I unit test an Apex controller method for dynamic components?

I have an Apex controller method that returns a Component.Apex.OutputPanel for use in a <apex:dynamicComponent /> tag. How do I do a unit test that asserts that the controller is outputting the ...
2
votes
1answer
293 views

Visualforce Page and standardController attribute in Apex Page

I am developing a Visualforce page which will be rendered when a Salesforce User arrives by clicking a specific Account. The Apex page looks something like this: <apex:page> ...
3
votes
2answers
89 views

Problem with using a variable in a controller from a Visualforce page

My problem is as follows: I've got a Site VF page with fields bound to a custom Lead object. One of these fields is a id field that's used for contact lookup. The controller seems to work fine but ...
1
vote
1answer
94 views

Using MVC architecture. Visualforce page unable to get list column from Model

I created an MVC software architecture. Here's the breakdown: M= Model_Enter_Discount V=Page_Enter_Discount C=Controller_Enter_Discount. On my Model_Enter_Discount page, I have created the following ...
0
votes
1answer
88 views

Validation for decimal field to restrict blank values and string values in visual force page

I have a visual force page in which I have a field to accept decimal values. I can restrict the user from entering 0.0 and null values, but I cant do the same for '' (Empty String). Is there any ...
1
vote
2answers
29 views

fetching data from model and want to show only 2/3 data per page and through command link want to go next page and show another data

I have few data in sobject model. i want to fetch those data and show only 2/3 data per page and there is below one command link is there through I want to go to next page and show another data. how ...
1
vote
2answers
48 views

Custom form not saved

Iam a newbe to APEX and I have the following form and Controller <apex:page controller="AddLinesController"> <apex:pageBlock > <apex:pageMessages /> <apex:form > ...
0
votes
0answers
21 views

How do I extend a standard Account Controller with a PageReference Class with a POST method for SSO credential passing?

I have the VF page and original class I will use to model the controller extension after. How do I extend the Account standard controller with a PageReference class with SSO parameters?
2
votes
1answer
105 views

Creating Salesforce Person Accounts via Visualforce

I have recently activated and configured Person Accounts in our salesforce org. We will be using these within the service console and also integrating Postcode Anywhere for address lookups. To ...
-1
votes
2answers
561 views

How to get the text fields values in the controller class without using any scripts

Im having a VF page it has some text fields and one button . On clicking the button , the values in the text field should be passed to the controller class to save in the database . Can this be ...
0
votes
2answers
68 views

Schedule VisualForce Extension and Actions

I'm getting out of my league with this little project so sorry if off base here. We have a custom button on a custom object page. Button calls VF page as listed below. Trying to see if we can easily ...
2
votes
1answer
382 views

CheckALL doesn't visually show all checkboxes as checked in Visualforce

I implemented a checkbox class with a checkaLL function(called using javascript) which makes sure to select All checkboxes as it should. However, the problem is that it doesn't visually show the ...
0
votes
1answer
94 views

How do I deploy an APEX class from one sandbox to another successfully?

I had to make a few updates to an APEX class in my development sandbox. I edited the class from the develop, apex classes menu in Salesforce, and then saved. I tested the class but am receiving the ...
0
votes
1answer
81 views

What do these lines on a controller extension mean?

I'm trying to build a test class for a controller extension on a Visualforce page and I need a more in depth description of what certain lines mean. Help on this would be appreciated. 1) String ...
2
votes
3answers
409 views

How to access outer class instance variables from inner class in controller?

I have an outer class with an inner class as part of a controller. I have tried setting the instance variables in the outer class as static, which allows the code to compile, but after the controller ...
1
vote
2answers
357 views

New Tab for PageReference

I want to open my Vf page on new tab please guide me what i need to do to get the process done my code : public PageReference totalbookedClick(){ date myDate = date.today(); integer ...
1
vote
1answer
109 views

Avoid SOQL 100 error by querying outside of the loop

I'm currently running a program which limits a query to 95 items in order to avoid the SOQL 100 queries error. THe relevant snippet of the program looks like this: while(x!=0){ ...
1
vote
1answer
452 views

How do you access a wrapper class from a Test class?

I have a VisualForce page which uses a controller. Within the controller I have a couple of wrapper classes which hold various form elements on the page. Everything works great, but now it is time ...
5
votes
3answers
88 views

Controlling Access to Force.com Site

Is there a way to control who access the force.com site externally besides using IP addresses? I tried using a profile checker: public static String ProfileCheck(){ String ReturnVal; Profile Pro; ...
3
votes
1answer
112 views

Unauthorized Page Redirect in Controller

I am trying to create a small authentication on my force.com site so that I don't have any random person accessing the site/visualforce page unless they are currently logged into Salesforce. Also if ...
1
vote
2answers
240 views

Creating a list button for a task

My goal is to create a btn on a task related list that launches a visualforce page and does a redirect. I tried using a StandardSetController, but Error: List controllers are not supported for Task ...
0
votes
1answer
182 views

Can you create mutilple columns of data from one controller in VisualForce?

I am trying to create a VF page with multiple columns of data from one controller. Here is the page so far:. What I need is for each of the Management Types to have it's own column and show all of ...
3
votes
2answers
377 views

Visual Force lookup Filter

I have a custom visual force page that let you create a new custom object. In this page there i have a custom lookup to choose the contact. Do you know if it's possible add a Filter condition to the ...
2
votes
3answers
869 views

Passing apex:inputField user entry as parameter into Command Link

I am getting the nickname from an inputField and updating a list of strings and displaying the list of strings on a table. The outputField displays the newly entered value, but the controller variable ...
3
votes
1answer
1k views

Removing rows separately from the Visualforce pageBlockTable list

I created a visualforce page (with controller) that allows adding multiple records to a custom object (master object is account). I can add new rows and save the new records, I'm also pulling ...
0
votes
0answers
25 views

Correct way to override save action in controller extensions [duplicate]

Is it ok to call standardController.save(); in a controller extension or should one always just do the custom stuff and then do a DML like upsert record; I have the feeling that calling the ...
9
votes
3answers
462 views

Knowing if a future call is allowed

I'm having an issue where we have some code that can be called anywhere and then it makes an @future call to log a message to an external system. The problem is if this method is called (either ...
10
votes
1answer
216 views

Difference between returning null and ApexPages.currentPage()

How is returning null different from returning ApexPages.currentPage() as a result of a controller action?
4
votes
1answer
196 views

DML not allowed in page action when nothing happens in constructor

This question may similar to DML not allowed in page action but I can't resolve it. This is my page: <apex:page Controller="MyController" action="/{!MyAction}"> Page loading... ...
3
votes
2answers
61 views

How to ensure something only happens once in a request?

If I have a page which include multiple components which means that multiple back end controllers get invoked on page load. How do I ensure that a piece of business functionality only happens once? ...
5
votes
1answer
130 views

Lifecycle of Controllers

I am just wondering about the life cycle of page controllers? How often are than instantiated and is there any configurations which can change this? Is there a method guaranteed to be invoked every ...
1
vote
1answer
174 views

Calling a dml statement in a constructor of a controller

I understand that we cannot have dml statement in controllers constructor. But in my case, i have a query string which is used to run our pages. So my code reads the querystring variable in the ...
2
votes
4answers
123 views

Ensuring a all controllers invoke a method

I want to apply this fix to an IE 10 problem. The thing is you could argue this fix should be applied to all controllers. I was thinking of having a base controller putting it in that and then all ...
-1
votes
2answers
189 views

Value of variable set after the constructor completes its execution [duplicate]

Here is the situation: I am passing a value from my component to its controller <apex:component controller="MyController"> <apex:attribute name="someObj" assignTo="{!receivedObject}" ...
0
votes
1answer
257 views

Custom Controller Case Attachment

I'm new to SF and trying to write a custom case controller that adds an attachment to a case. I've simplified my apex code below. I'm guessing I need to do a.OwnerId = UserInfo.getUserId(); to get ...
4
votes
1answer
171 views

Subtotal vs Aggregate Function

I have created a custom object Commission_Rec__c with a master/detail relationship with a custom child object of Order_Entry__c. What I am trying to do is create a vf page that will display ...
1
vote
1answer
96 views

How to set a value at runtime in a visual component on a component controller?

I have an interesting problem. I have a visual force component where i am looping through a list of data objects say MenuItem data object for now. Now i populate this list on a property in the visual ...
0
votes
1answer
461 views

get set to apex:selectOption

I am trying to set a value from my controller to my apex:selectOption value. I have created a get set method and the value in the get set have been changed but no change at all in apex:selectOption. ...
1
vote
1answer
202 views

Custom New Button that creates record of specific type and parent record in Visualforce Controller (No URLFOR!)

Sorry for the lengthy title. But I want to make sure that I was not able to solve my problem with the standard answers to questions like this. I have a CustomObject_c that has many record types and a ...
4
votes
2answers
377 views

Debug ViewState Problems in Force.com Sites VF Pages

We're implementing a complex web application based on force.com Sites and ran into problems with the ViewState size of one of our pages. Now on the platform I would activate Development Mode and the ...
3
votes
4answers
2k views

restful call to external analytics API via visualforce/apex

So I'm trying to access Woopra analytic's restful API via apex/visualforce. I am wondering a couple of things: 1) The API returns a JSON object via the usual POST/GET method... would it be best to ...
1
vote
2answers
182 views

referencing an object in a map in visualforce

So, given the following controller snippet and VF page snippet... public Map<String, Region__c> divisionaddresses {get; set;} public List<String> allDivisions {get; set;} public ...
1
vote
3answers
250 views

System Null Pointer Exception: debug help

So I have the following controller: List<User> users {get; set;} public reshapeUserDivisions() { users = new List<User>(); users = [SELECT Id, Division, FROM User WHERE ...
3
votes
1answer
287 views

how to make a list persist in a controller on page redirect

I have the following search function: public List<User> SearchResults {get; set;} public ContactSearchController() { if(SearchResults == null) { ...
2
votes
5answers
2k views

displaying a Map<String, Map<String, Object>> in visualforce page

so, say I have the following map: public Map<String1, Map<String2, Object>> objectMap {get; set;} public List<String> ListofString1Entries {get; set;} public List<String> ...
6
votes
2answers
218 views

How to pass session state between multiple custom controllers

I have a 65 multi step wizard form where i need to collect data on each step and have a previous and next button on each page. I have to store the data on each page and finally at the end store all ...
6
votes
1answer
164 views

How can I change the HTTP status code on a Visualforce Page?

I'm trying to develop a Page that given some GET parameters would return HTTP Status 200 or status 400 depending on some inner query. This would be really easy with a RESTful service, but we need ...