We have a visualforce presenting a list of dates. It uses a repeater to display the dates to a user and I have been trying to add a button to the repeater that then saves the value to the controller to update the record. It is a detail page visualforce page.


<apex:page standardController="Order" extensions="customOrderExtenstionTest" showHeader="false" standardStylesheets="false" >
         <apex:repeat value="{!list}" var="currentDate">
            <apex:outputText value="{0,date, EEEE dd MMMM yy}">
                <apex:param value="{!currentDate}"/>    
            <apex:commandLink  style="btn" action="{!saveDate}" value="Select Date" reRender="hidden"> {!currentDate}
               <apex:param name="selectedDate" id="param1" value="{!currentDate}" assignTo="{!selectedDate}"/>
            <apex:outputPanel id="hidden" rendered="false"/>

And the apex is pretty simple:

Apex Custom Controller

public with sharing class BulkyItemOrderCalendarController 
public Date selectedDate {get;set;}
public pageReference saveDate(){
        system.debug('SELECTED DATE ============' + selectedDate);
        currOrder.Allocated_Date__c = selectedDate;
        update currOrder;
        return null;
    catch(Exception e){
        System.debug('Exception occurred '+String.valueOf(e));
        return null;

An error is always displayed stating "Argument cannot be null". However I can see the content of {!currentDate} printed on the VF page. I am aware of the commandButton issue so I have tried commandLink without success (above) but I also tried the rerender of a hidden panel hack too.

Thanks, sorry I fear it is another obvious mistake/misunderstanding.

  • 2
    I think you have to add the name attribute to your <apex:param> tag for it to actually bind back to the controller. Can't hunt down where I read that at the moment.
    – Adrian Larson
    Sep 13, 2017 at 16:09
  • Thanks, I added a name attribute in (I edited the code above) but I am afraid the same thing happens. Sep 13, 2017 at 16:13

1 Answer 1


Yes as Adrian mentioned in comment Name works as a key so you need to add that as well. Without it you don't get any error but your value will not be passed to controller.


Also Date type can't be directly passed as Apex:param only support string, number, or boolean value. So you need to convert it into string pass it into controller and then in controller change it into date again.

<apex:param name="setDescription" value="{!TEXT(date2)}" assignTo="{!dateString}" />
  • 1
    Thanks that is much better. Thanks. I can see the date being passed and in the debug it is format as yyyy-mm-dd yet I am receiving an error stating: "Exception occurred System.TypeException: Invalid date: 2017-10-27" I used "date.parse(selectedDate);" Sep 14, 2017 at 9:22
  • got it working with date.valueOf(selectedDate); thanks. Sep 14, 2017 at 10:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .