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.
1
vote
1answer
25 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 ...
3
votes
3answers
37 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
28 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
44 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
47 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 ...
2
votes
1answer
39 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
131 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
313 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
235 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
77 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
68 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
52 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
58 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
57 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
70 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
67 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
59 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 ...
1
vote
1answer
70 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 vfpage the will display information ...
0
votes
1answer
42 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
213 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.
...
0
votes
1answer
99 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
154 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
600 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
65 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
117 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
143 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
959 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
87 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
116 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 ...
0
votes
1answer
75 views
object Name being replaced with object ID
So, the relevant snippets of code are:
function doFunction(choice)
{
switch (choice)
{
case "changename":
...
5
votes
1answer
75 views
Is there away to pull a users standard layout in edit mode and place it on a VF page?
I know there's a ways to do this using tag to view the detail page, but once you hit edit it will use salesforce standard edit page. I've also created a custom edit page but the problem I'm running ...
3
votes
1answer
64 views
Render a tab for certain public groups
I have a custom page that overrides the default account page, dividing it into multiple tabs.
I was wondering if there was a way to use the "rendered="{!IF($.........."
to make the tab available to ...
0
votes
1answer
35 views
partition a table of Contacts based on a field value in VisualForce page
So, Say I have the following visualforce page:
<table width="100%" border="0">
<tr>
<td valign="top">
<apex:pageBlock mode="edit" id="results">
...
1
vote
1answer
254 views
Passing parameters to Extension Controller for test
I have a Extension Controller which gets back a different set of Opportunities based on the value of HTTP parameter named display sent in. So my code is as such:
public ...
1
vote
2answers
175 views
VF controller system context versus Sites Guest User object permissions
I'm trying to clarify VF controller context versus Sites Guest User permissions on Contact record.
From everything I've read, a VF controller using "without sharing" operates in the system context. ...
2
votes
1answer
183 views
Passing parameter to controller extension?
I wish to create hyperlinks to a specific visual force page which displays a list of opportunities. The data in the page will need to be different. In some cases it will be all open opportunities ...
4
votes
2answers
228 views
Unable to pass a parameter <apex:param> to a relevant method
Lets assume I have a Page code:
<apex:pageBlockTable value="{!allContacts}" var="c" >
<apex:column value="{!c.id}" headervalue="ID"/>
<apex:column ...
0
votes
1answer
212 views
Maintaining the same URL (/apex/wizard?id=xxx) across a multi-page wizard
I have a very simple controller and 3 visualforce pages below which form a 3-page wizard.
The wizard begins at wizard.page with an id parameter so the URL takes the following form ...
1
vote
4answers
749 views
Page does not render the right component
I've been struggling with this for a few days now.
I have a Visualforce page that should trigger a search method on the controller.
When the method returns the page should render the result.
The ...
7
votes
2answers
270 views
Custom Controllers - effect of running in System mode
The VisualForce Developer's Guide says:
Like other Apex classes, all custom controllers run in system mode. Consequently, the current user's credentials
are not used to execute controller logic, ...
0
votes
2answers
1k views
how to get a picklist all values in apex controller
I have a Student object and have a pick list field "Student Status" in this object. Status can be Full-Time OR Part Time. Now my requirement is i want this student status list, Part-Time or Full-Time ...
3
votes
1answer
177 views
Generic Controller class?
I have a custom Visualforce extension which accesses information stored in custom settings and exposes it as variables which can be referenced from Visualforce. I'd like to be able to use this ...
1
vote
4answers
3k views
Difference between controller and extensions
Can any one explain the usage of controller and extensions in Visualforce? In which scenario we have to use controller and extensions?
Thanks in advance
3
votes
2answers
114 views
Code Caching Issue?
I have a sites page, and it seems to work fine from a functional perspective. It has a custom controller that retrieves some data from a custom object and the Contact object, displays the data to the ...
2
votes
2answers
116 views
How to get records name from another Page
Say suppose in Object1(Project) I have records.....Now my requirement is in a vf page I have to get the Object1(Project) names for a field.....For this I have Quered like this
...
2
votes
2answers
64 views
Having trouble getting the KnowledgeArticleViewStat for the KnowledgeArticle
So I am trying to get the KnowledgeArticleViewStat for a specific KnowledgeArticle. I am using the KnowledgeArticleViewStat.ParentId to match it to the KnowledgeArticle.Id.
This is my controller:
...
2
votes
2answers
1k views
How do I access a Map in my Visualforce page?
I have a custom controller that returns a map like this:
Map<String, String>
In my visualforce page, how do I access this map? Before the Winter '13 release, I could do this:
...
3
votes
3answers
555 views
Test Visualforce Page With Over a Thousand Select Options
I have a custom visual force page which is throwing the error -
I have found the line which causes the error and know how to fix, but just need to write a test class which will recreate the error ...
0
votes
3answers
121 views
Getting an error when trying to create a custom page with a custom controller
I am trying to create a custom Visualforce page with a custom controller by following the example on this page:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_custom.htm
...



