1

I know usually it is impossible to handle the Post a request to a Visualforce page. But I kind of need a decent way to resolve the following scenario:

In my VF page one, I have a button to open VF page two. And by opening VF page two, I need to pass several variables. One of them is an Array.

One option to me is obviously use JSON to serialize the array, URL-encode it and pass it as a query string variable. But that solution would be pretty ugly and the query string can easily be too long. Is there a better way to achieve this?

  • Can't we call child VF page jasvcript and pass the array in that ? – Ratan Paul Jan 29 '16 at 6:34
  • @Ratan do you have a sample code on how to do it? – Lance Shi Jan 29 '16 at 6:38
  • Lence.. Currently I dont have(I need to research) but mean while you can ask this question here stackoverflow.com/questions/ask I am pretty sure you will get your ans. – Ratan Paul Jan 29 '16 at 6:39
  • @Ratan I guess it is a bit different. For general web pages, I guess the best way is just to use a post request and handle it at server side, which is not an option in Salesforce though. That's why I am asking here. – Lance Shi Jan 29 '16 at 6:42
  • @Ratan Also, I am quite tempted to handle it at server side if it is possible. Doing it via browser variable is possible, but still pain. – Lance Shi Jan 29 '16 at 6:46
2

You can pass data through your VF controller variables. Use PageReference.setRedirect(false); when redirecting to your second page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.