Can I pass a variable into an apex:actionFunction call as follows:
deleteThing(thing_id);
<apex:actionFunction name="deleteThing" action="{!deleteAttachment}" reRender="none"
oncomplete="remove_deleted_thing(thing_id)">
<apex:param name="thingToDelete" value="" assignTo="{!selectedAttachmentId}" />
</apex:actionFunction>
public String selectedAttachmentId {get; set;}
public PageReference deleteAttachment() {
Attachment attachment = getSelectedAttachment();
delete attachment;
return null;
}
private Attachment getSelectedAttachment() {
return [SELECT Id FROM Attachment WHERE Id= :selectedAttachmentId];
}
function remove_deleted_thing(thing_id) {
console.log(thing_id);
}
So that after {!deleteAttachment} runs in my controller, thing_id will be passed to remove_deleted_thing()?
I'm not even getting 'undefined' in my console now, so I assume I'm doing somthing wrong here. The code does what it's supposed to do up until remove_deleted_thing.
Amy suggestions or advice would be greatly appreciated.
return false;
so the code would beoncomplete="remove_deleted_thing(thing_id);return false;"
action
method working fine without any exceptions?