+ Start a Discussion
waylonatcimwaylonatcim 

page redirection based on url parameter

I'm trying to re-direct a page based on a url parameter.  I've tried the following line in the apex:page tag:

 

action="{!IF($CurrentPage.parameters.mode='delete',deleteNote,null)}"

 

but that fails since I apparently can't have a function (deleteNote) returned from the If statement. 

I realize that I can just call an apex function that will handle the logic for me and pass the correct page reference back, but I'm wondering if there is a way to handle this in Visualforce.

 

Thanks

 

 

jwetzlerjwetzler

Yeah, that's not really going to work.  If you really had to do this strictly in VF you could create two buttons, one that has the deleteNote action and one that doesn't have an action at all, and conditionally render them based on the query param, but since you are already using a custom controller I wouldn't clutter up your page like that.