You need to sign in to do that
Don't have an account?
How to pass values in Visualforce pages
Thank you for your assistance.
I would like to pass parameters from a Visualforce page to the Visualforce and controller classes of the administration package.
URL parameters can be passed, but not when POSTing.
In the development environment, it can be passed, but not at the installation site.
What is the cause?
■Code
・In the original Visualforce page,
Parameters are set by Javascript window.onload before submit.
・The controller on the original Visualforce page is Account
・he controller of the management package is customCon.
Can someone please help me?
I would like to pass parameters from a Visualforce page to the Visualforce and controller classes of the administration package.
URL parameters can be passed, but not when POSTing.
In the development environment, it can be passed, but not at the installation site.
What is the cause?
■Code
・In the original Visualforce page,
<form id="SubmitForm" action="/apex/sapmplePage" method="post" style="display:none"> <input type="hidden" id="ids" name="ids"/> <input type="hidden" id="obj" name="obj"/> </form>
Parameters are set by Javascript window.onload before submit.
・The controller on the original Visualforce page is Account
・he controller of the management package is customCon.
String id = ApexPages.currentPage().getParameters().get('ids');
Can someone please help me?
Apex Code Development
Without access to the specific code and configuration details of your package, it's challenging to provide an exact solution.
It seems that you are encountering difficulties passing parameters from a Visualforce page to a controller class, particularly when using the POST method and in different environments.
The issue might be related to the way parameters are being handled in the Visualforce page and the controller class.
Some possible causes and solutions based on the search results:
> One approach to passing parameters from a Visualforce page to a controller is by using the apex:param tag within an apex:actionFunction. However, it has been noted that the apex:param works with the action function only if there is a rerender attribute on it. This might be causing issues when trying to pass parameters without using apex:param.
> When using a controller extension, it's important to ensure that the extension is properly initialized and that the method in the controller extension is being called correctly to retrieve the parameters from the Visualforce page
>It is also possible to pass hardcoded strings as parameters from a command button and use them in an Apex class. You need to ensure that the value is being correctly assigned and retrieved in the controller class
>When using a POST request, parameters are typically included in the request body rather than the URL. In your form, you are using a hidden input field, and it should work for both GET and POST requests. However, ensure that you are correctly setting the values of these hidden fields using JavaScript.
<form id="SubmitForm" action="/apex/namespace__sapmplePage" method="post" style="display:none"> <input type="hidden" id="ids" name="ids"/> <input type="hidden" id="obj" name="obj"/> </form>Related:
https://developer.salesforce.com/forums/?id=906F0000000B24aIAC
https://salesforce.stackexchange.com/questions/141935/how-to-pass-parameters-from-a-vf-page-to-a-controller-extension
https://stackoverflow.com/questions/50174067/pass-hardcoded-strings-as-parameters-from-command-button-and-use-in-an-apex-clas
https://stackoverflow.com/questions/50124922/pass-a-parameter-from-page-to-controller-without-apexparam-in-visualforce
Heads up — this is your last chance to get your Trailblazer account set up and connected to your forums discussions on this site.
Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
- If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
- If you already have a Trailblazer account, and it’s using a different email address from your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Find more info & supportWe know that moving platforms can be a hassle, so we created a special forums users group, the Migration Support Hub, in the Trailblazer Community where you can find other forums users and get training videos, the latest information, and assistance.
We want to thank you for all of your time, energy, and contributions made here in the Salesforce Discussion Forums.
We’ll see you in the Trailblazer Community!
Sincerely,
The Forums Support Team