I am trying to implement a cancel button in a visualforce page which should lead to the previous page.
The first page (welcome) has two links link1 and link2 based on the link clicked a different section of the landing visualforce page is rendered.
I pass parameters using apex:param in the welcome page based on the link clicked.
But, the value I receive in the landing page is always null.
The landing page has the cancel button which should lead to the welcome page. When cancel is clicked only the query parameters passed in the URL vanish and remains on the same page.
What am I missing here? Please help as I am new to visualforce 🙂
I strongly suspect you don’t even need setRedirect here. Or action method in controller for that matter.
First experiment with something simple:
Immediateskips any kind of validations etc you might have.Actioncan be a normal link, something more magical likeURLFOR()function or the merge field that links to your controller’s action method (plus certain standard actions like{!save}are available if you have standardController on the page.There are couple of questions similar to this one on Salesforce-dedicated site StackExchange site. Check https://salesforce.stackexchange.com/a/4242/799 and https://salesforce.stackexchange.com/a/4707/799 (if you want to see bit more advanced example of URLFOR).
As to why this might be the case – maybe you could post the welcome page’s controller (especially constructor). Are you reading the values from the
PageReferenceor do you expect parameter setters to fire on the initial request? Do both pages share same controller or controller extension? Generally speaking it’s a quite big topic 🙂