You need to sign in to do that
Don't have an account?
uxtx_tim
pageReference with javascript
Trying to figure out how to set a string constructed in javascript to a pageReference partialURL object.
So Im generating a string in javascript that relates to a field in one of my objects. If I could set that string to a pageReference('partialURL ') in my controller, I could navigate to thepage for that specific object. However, I can't figure out how to reference apex controller variables with javascript., specifically PageReference parameters. Any suggestions or documentation you can point me to?
why don't you use redirection from the javascript itself like:
location.href = '/' + your Url string.
if it's a vf page then
location.href = '/apex/' + your Url string.
However if youy still want the redirection from the controller, you can create an action frunction on the page and can pass this string as a param . So from the action defined in the actionfucntion component you can get your redirection.
but still I would go javascript part as it is much simpler.
All Answers
why don't you use redirection from the javascript itself like:
location.href = '/' + your Url string.
if it's a vf page then
location.href = '/apex/' + your Url string.
However if youy still want the redirection from the controller, you can create an action frunction on the page and can pass this string as a param . So from the action defined in the actionfucntion component you can get your redirection.
but still I would go javascript part as it is much simpler.
Thanks for responding! I can definitely do that in javascript and navigate away from the current page an open a new one. It is a vf page btw.
What I'd like to do, and what I failed to make clear in my question, is use the partial page refresh so I'm not actually navigating away from the current page.
I'm going to look into the action function as I've never implemented it before - thanks again!
I have yet to understand the relationship between an <apex:param> and it's parent component.
The entry for the <apex:param component in the Visualforce Dev Guide is quite vague, as it gives no explaination for the example.
In that example
It looks like the resultant search will be for whatever name is associated with the current contact.
What is name="q"? What would name="q" be used for?
Name is not for any use, it's just only an identification for tha param you created.