You need to sign in to do that
Don't have an account?
How to get a value from a javascript variable in Visualforce
Hello, I wish to use the following scenario but I'm not 100% sure if ti will work.
- I call a javascript function from a href ink in my visualforce page.
- within the javascript function a variable is set.
- in an apex:outputLabel (for starters but I will need ot access the variable elsewhere) the value comes from the variable I set in the javascript function.
Can this scenario be done?
I note the scenario can be done the opposite way around (Javascript can get a value from a visualforce component) View $Component in http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm but can the scenario I require be carried out?
Thanks in advance.
You might try putting a component on your VF page that is not visible. Set that value in javascript, and access it from VF. I haven't done exactly this, but it should work the same as if you are changing a value on the page from javascript.
Hi JanitaB2, Thanks for your suggestion. The part I'm not sure of is how do I access the variable set via Javascript?
I know how to set a variable in Javascript but not how to access one which was set by javascript.
Thanks,