function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

having problem using apex:param and assignTo



I need to pass a parameter to my controller but it seems that this parameter is always empty when the action is executed. Any ideas?



private String attachmentToRemove;

public String getAttachmentToRemove() { return this.attachmentToRemove; }

public void setAttachmentToRemove(String el) { this.attachmentToRemove = el; }


public void deleteAttachment() {

System.debug('PARAM::::::::::::: ' + attachmentToRemove);


 From the logs: 


PARAM:::::::: null


<apex:commandLink value="Remove" title="Remove attachment" action="{!deleteAttachment}" onclick="showRemoveFileLoadingIcon('{!}'); reRender="fileListing">

<apex:param assignTo="{!attachmentToRemove}" value="{!}" />



it seems that the "{!attachmentToRemove}" is never called? 




Message Edited by lopezc on 02-18-2010 03:23 AM
Best Answer chosen by Admin (Salesforce Developers) 

i faced the same issue when i declared the getter and setter seems using getter and setter methods doesnt work with param... so instead of writing getter and setter methods... you just need to declare attachmentToRemove as below


public String attachmentToRemove

{ get;set; }



it worked fine for me...


one more also need to use the name attribute of param.. to make it work...


i hope this helps...