17
votes
Accepted
Define APEX method with default arguments
In some use cases, you might want to consider fluent constructors on classes (or inner classes)
public class Foo {
Integer bar = 0; // default
String fie = 'Hello';
public static Foo ...
8
votes
How do I pass a query string param to the Controller
You can retrieve parameters passed in the URL directly:
ApexPages.CurrentPage().getParameters().get('d')
8
votes
Define APEX method with default arguments
Yes, you have to define method overloads. That is the only way to specify default argument values.
5
votes
Accepted
apex:actionFunction with apex:param Param not setting
Found out what the problem was and thought I'd post it here in case anyone else has the same issue.
Because the start and end were objects (moment), they weren't casting properly to the controller ...
4
votes
Accepted
Can apex:param pass null for Integers?
It looks like the problem is that when the parameter comes over as an empty string, salesforce converts the value to 0 instead of NULL. You could consider setting the value of index in your method ...
4
votes
Accepted
Same apex method different output
Even though you only have 1 SOQL statement in your code it gets executed 3 times, once for every call to Count().
If you use a map where the key is the status and the value is the count you can do ...
4
votes
Accepted
Pass a JavaScript Date var as the apex param value
JavaScript is client side, while apex code renders server side. In other words, Salesforce tries to convert the literal value of "today" into a date using valueOf, which fails, because it's not a ...
4
votes
Accepted
apex:param not assigning value within apex:actionSupport for apex:inputCheckbox
The actionSupport tag is to enable AJAX support on the page and hence only works for AJAX requests. In order to get it working, all you need to do is put the "Selected:" portion in an outputPanel and ...
4
votes
Accepted
Pass value from the visualforce page to a global variable of a class
A good solution to this is to use a proxy object in the controller to capture the dateTime value
public Event evt { // proxy object, fld StartDateTime is creatable
get {
if (this.evt == null)
...
4
votes
Accepted
Apex:param not sending parameter in actionFunction
I have had mixed luck doing it like that (probably my own fault). However I know this works (string values):
public string paramValue {get;set;}
public pagereference AttachFile(){
system....
4
votes
Passing Id of object
The parameter you are sending is not called 'associateProject' but 'associatedProduct'.
You just have to do:
String project = ApexPages.currentPage().getParameters().get('associatedProduct');
4
votes
Accepted
Passing Parameters Commandbutton
Need to be add a DummyID for reRedner.
<apex:page controller="clicktest">
<apex:form>
<apex:commandButton action="{!Stats_In}" value="click" reRender="dummyId">
<...
4
votes
Accepted
Using Param in ActionFunction - Unexpected Token ':'
You need to specify a name attribute, or you would get unexpected behavior.
<apex:param name="aValue" value="" assignTo="{!variableFromVfp}"></apex:param>
3
votes
Accepted
passing a param in a dataList and commandLink
Try changing it to this by adding a name attribute to the Apex:param
<apex:param value="{!relation.Id}" assignTo="{!selectedDetailID}" name="dtlIdParam"/>
Source:
<apex:param> assignTo ...
3
votes
Accepted
Can't seem to pass param from VF page into my Controller
The problem with your code is that the apex:param is outside of the apex:actionFunction. Other code looks ok, but it is uclear what changes you have made on it. So i will post here a working example ...
3
votes
Can't seem to pass param from VF page into my Controller
use actionfucntion like below because in your code param is outside from the action function which is not the right way. Please give it a try and let us know.
<apex:actionFunction name="...
2
votes
Using <apex:param> to set query string parameter that's already defined
Not sure why it doesn't update the parameter, but could you perhaps use a different ID in the URL when loading the page?
<apex:detail subject="{!IF($CurrentPage.parameters.cid != null, $...
2
votes
Accepted
How get value apex:inputField on Apex Controller
The controller parameter of your constructor can return a reference to the record bound to the page using controller.getRecord(). You can then check this value directly. You don't need to use an apex:...
2
votes
apex:actionFunction with apex:param Param not setting
Try to change Salesforce API version of the page and controller to 30.0 instead of 31.0.
I ran into the same issue recently and this helped me.
Let me know if it works for you.
2
votes
Accepted
outputText using a function with param
The wrapper approach - the normal solution to providing derived values in a table row - would be to return a list of this inner class:
public class Wrapper {
private MyController c;
public ...
2
votes
ActionFunction rerender messing with Pagereference
So I have to do a workaround for this. I am still keeping my rerender since it returns the params I need, but I am now redirecting the page using javascript.
<apex:actionFunction name="save" ...
2
votes
Accepted
Adding bold style to outputText seems not to work
You can define your own CSS class that will make all TH's in a certain table bold:
#pageblockTable th {
font-weight: bold !important;
}
This CSS applies to all TH elements that are children of ...
2
votes
Accepted
commandLink and commandButton with image not passing parameters
As Pramod says, this is a known issue, the alternative workaround is to add reRender=... to your commandButton
<apex:commandButton action="{!getRichiestaDetail}" image="{!$Resource.detail_icon}"
...
2
votes
Accepted
Auto-closing Modal Issue with Bootstrap3 and apex:commandLink
In your commandlink tag, you need to use rerender tag to implement AJAX so that your page will not be refreshed. You can check visualforce component reference to see how rerender can be used with apex:...
2
votes
Accepted
apex param in apex repeat (pass parameter to controller in repeat) not working
Instead you can use the IF condition in the value attribute of the outputText
<apex:outputText value="{!IF(activeUser.Name == like.user.Name, 'You', like.user.Name)}" />
2
votes
Accepted
Define apex:variable in apex:inputText
you can try something like
<apex:variable var="input" value="" />
<apex:inputText value="{!input}" styleclass="textCls"/>
<apex:commandButton value="Search" onclick="...
2
votes
Accepted
How to pass js confirm response to an action function
<apex:actionFunction name="doSave" action="{!save}" rerender="none">
<apex:param name="param" assignTo="{!myControllerBoolean}" value=""/>
</apex:actionFunction>
<apex:...
2
votes
param is not assigning values
apex:param is working perfectly, problem is with command button rerender
<apex:commandButton action="{!doSomething}" value="Click" rerender="none">
<apex:param name="param1" value="{!...
2
votes
apex:param not passing parameter to controller
Though optional you have to put in a name attribute for the apex:param.
Update:
A similar question was answered on why param needs a name attribute. Param gets passed as a key value pair to the ...
2
votes
Accepted
apex:Param not working with CommandButton component
Create a property in your controller, like
public propField {get;set;}
and assign it to the item.field__c like
item.field__c = propField;
Now, in your VF, set the property, like
AssignTo="{! ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
apex-param × 65visualforce × 43
apex × 29
controller × 9
actionfunction × 9
javascript × 6
commandbutton × 6
parameters × 6
repeat × 5
actionsupport × 5
list × 3
commandlink × 3
dynamic-visualforce × 2
rerender × 2
pageblocktable × 2
table × 2
outputtext × 2
lightning-aura-components × 1
lightning-web-components × 1
soql × 1
unit-test × 1
salesforce1-app × 1
code-coverage × 1
visualforce-component × 1
aura × 1