18 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 ...
  • 65.7k
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.
  • 146k
5 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"> <...
  • 2,485
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....
  • 53.6k
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');
  • 7,258
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) ...
  • 65.7k
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 ...
  • 12.4k
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 ...
  • 12.2k
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 ...
  • 456k
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 ...
  • 1,500
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>
  • 456k
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

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:...
  • 3,083
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="{!...
  • 662
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 ...
  • 16.6k
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="{! ...
  • 5,762
2 votes
Accepted

Passing counter variable (apex:repeat + apex:var) into apex:assignTo yields 'null'

You have to rerender the form in commandButton <apex:commandButton action="{!deleteNewChild}" rerender="yourform" value="Remove"> <apex:param name="indexOfNewChildToRemove" ...
2 votes
Accepted

Passing Param to Apex Class for Delete from PageBlockTable

apex:param : A parameter for the parent component. The component can only be a child of the following components: <apex:actionFunction> <apex:actionSupport> <apex:commandLink> <...
2 votes

Passing Parameters Commandbutton

Just add a dummy panel and reRender it. It will work. <apex:outputPanel id="panel2"> </apex:outputPanel> <apex:commandButton action="{!Stats_In}" value="click" reRender="panel2"> ...
  • 3,821
1 vote
Accepted

<apex:param/> tag seems to always assign the last value on visualforce page, regardless of which event was clicked

The docs state "adds AJAX support to another component" <li id="li1" class="active"> <apex:outPutPanel layout="inline"> <a id="anchor1" href="#tab1" data-toggle="tab"> <...
  • 53.6k
1 vote

Passing Id of object

Try adding the assignTo attribute on your <apex:param>. This will allow you to assign the value you're trying to access to a variable in your controller. In Visualforce: <apex:...
  • 1,487
1 vote

Vf page error when try to delete row on vf page

The core issue is that you need to use <apex:commandLink> here, not <apex:commandButton>. From the documentation for the <apex:param> tag: The <apex:param> component can only ...
  • 146k
1 vote

How to implement <apex:param> using dynamic visualforce components

As per this document: Dynamic Components Supported Attributes <apex:param> and few more attributes are not valid in dynamic components creation. The following standard Visualforce ...
  • 22.3k
1 vote
Accepted

String coming through as null after apex:param

If CXT_Opportunity_Name__c is a Lookup to another object, you're passing the object value to a String which wouldn't work. What you'd need to do is assign the value to an instance of that object, ...
  • 7,087
1 vote

String coming through as null after apex:param

You are missing rerender here. Add rerender in your actionsupport and also add in value in param <apex:actionSupport event="onchange" action="{!checkIfSelectedContactHasPendingOpp}" rerender="none"...
1 vote
Accepted

not getting actionfunction parameters on controller method

You will have to reRender the elements on the page to set the values at backend I would designate an Id with an outputPanel and reRender <apex:page controller="SendAgreementExt" id="thePage"> ...
1 vote

apex:repeat with Save button, saves only first record in it

You need to change your repeat to use updatMembersList: <apex:repeat value="{!updatMembersList}" var="child"> You don't really need two separate List<Member> properties, though. The ...
  • 146k

Only top scored, non community-wiki answers of a minimum length are eligible