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
lopezclopezc 

having problem using apex:param and assignTo

Hi,

 

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('{!attachment.id}'); reRender="fileListing">

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

</apex:commandLink>

 

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

 

Thanks 

 

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

i faced the same issue when i declared the getter and setter methods...it 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 thing...you also need to use the name attribute of param.. to make it work...

 

i hope this helps...