You need to sign in to do that
Don't have an account?
agab
Cannot save Visualforce page when using CurrentPage global variable
Hello,
I am opening a new Visualforce page via an URL when I click on a button from the Leads tab page. I am also passing a parameter in the URL query string i.e. /apex/myVisualforcePage?p=val.
I am trying to retrieve the 'p' parameter on the opened Visualforce page using the following: {!$CurrentPageReference.parameters.p}. The problem is that I cannot even save the Visualforce page. I get the following error:
Error: Field parameters does not exist. Check spelling.
Is this not the way to retrieve parameters from a query string, and shouldn't this work?
Thanks,
agab-
Can you show me how you're using it in your page? I am able to specify this in my pages. Please use the SRC button when posting code.
You can access this in your controller by using ApexPages.currentPage().getParameters().get('p'); And then you can expose that as a property on your controller if you need to bind to it elsewhere on the page. However if you're submitting an apex:form then I don't see the need for an inputHidden when you can simply access the property in your controller.
Anyhow, I created a Controller to implement the binding as you mentioned and it now works the way I had wanted it to work. The 'p' value is captured and set in a Controller attribute which is bound to the hidden field on my Visualforce page; my javascript can now retrieve the value via the getElementById method. Thank you so much for taking the time to explain this to me.
Sincerely,
agab-
Seems like if you need to get the value into your javascript function you can just do it in your script tag.
<script>
var param = '{!$CurrentPage.parameters.p}';
</script>
Thanks,
agab-