Skip to main content
19 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 ...
cropredy's user avatar
  • 72.1k
9 votes

Define APEX method with default arguments

Yes, you have to define method overloads. That is the only way to specify default argument values.
Adrian Larson's user avatar
  • 151k
6 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"> <...
NITHESH K's user avatar
  • 2,535
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....
Eric's user avatar
  • 54.2k
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');
Martin Lezer's user avatar
  • 7,295
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) ...
cropredy's user avatar
  • 72.1k
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>
sfdcfox's user avatar
  • 497k
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="...
Tushar Sharma's user avatar
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="{!...
Akshat's user avatar
  • 682
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" ...
Santanu Boral's user avatar
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="{! ...
Mahmood's user avatar
  • 5,966
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 ...
Rao's user avatar
  • 16.7k
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"> ...
Rohit Mourya's user avatar
  • 3,871
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:...
Tushar Sharma's user avatar
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> <...
Avijit Chakraborty's user avatar
1 vote

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

Using apex:variable inside apex:repeat is an undefined operation. While it technically does work, there are known glitches with it. I would expect that you'd have problems with this. The problem ...
sfdcfox's user avatar
  • 497k
1 vote
Accepted

How do I code a 'confirm send' button on my VisualForce page?

You can do it in two way Add your method to action and add onclick method onClick="if(confirm('Are you sure you want to send the email?')){return true;}else{return false;}" You can call action ...
Rahul Gawale's user avatar
  • 12.2k
1 vote

apex:param get just last element. How to fix that?

apex:commandButton does not support apex:param, and will have unexpected behavior. You would need to use one of the supported elements instead. Please read the documentation for apex:param. The ...
sfdcfox's user avatar
  • 497k
1 vote
Accepted

Visualforce page - Trying to delete record from a pageBlockTable using ActionSupport, but id is null?

apex:actionSupport is meant to be inside other elements, not outside; the click handler actually ends up bubbling up to include the entire table cell because of this. Also, since the param was on the ...
sfdcfox's user avatar
  • 497k
1 vote

Visualforce page - Trying to delete record from a pageBlockTable using ActionSupport, but id is null?

You need to add rerender attribute in commandLink. Also you don't need actionsupport here you can easily do using apex:commandLink. <apex:commandLink rerender="none"
Tushar Sharma's user avatar
1 vote
Accepted

Apex param not passing the value in Selectlist

To pass param value in controller we must use rerender attribute. Use rerender attribute with your apex:actionSupport. It will solve your issue. <apex:actionSupport event="onchange" action="{!...
Tushar Sharma's user avatar
1 vote
Accepted

Null apex:param when value is from map

I'm sorry to say that you can't pass an object as a parameter. Salesforce says: The value attribute must be set to a string, number, or boolean value. So you'll have to extract the value you want ...
Caspar Harmer's user avatar
1 vote
Accepted

delete row when click on hyperlink of delete

There are couple of things which are not handled correctly. Your actionFunction should have reRender attribute. You have used reRendered. Create List<Stud__c> using getter instead of defining ...
Rohit Mourya's user avatar
  • 3,871
1 vote

delete row when click on hyperlink of delete

Try changing this piece of code <apex:pageblockTable value="{!contacts}" var="co"> <apex:column headerValue="Delete Record"> <a href="#" onClick="remove('{!co....
Ashwani's user avatar
  • 22.6k
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"> <...
Eric's user avatar
  • 54.2k
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:...
SFDC Neuf's user avatar
  • 1,537
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 ...
Adrian Larson's user avatar
  • 151k
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 ...
Ashwani's user avatar
  • 22.6k
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, ...
Dan Jones's user avatar
  • 7,227
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"...
Tushar Sharma's user avatar

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