I have a problem in a Visualforce page for a site page...
The process involve:
Html + css + jquery
ActionFunction => with rerender, with parameters
Redirect from a https tio a http
jquery actually reads the data from the document, manipulates them and calls an actionFunction passing some variables. These variables are expected to be asigned to the parameters associated to the actionFuncion. Here happens the first strange thing that we are not able to understand and manage it (looks like there is some magic)
if you use the rerender parameter of the action function then the
<apex:param>
of the actionFunction are defined. If the rerender parameter is not used, the<apex:param>
are not defined (it's like they do not exist for the controller). The method of the controller called by the actionFunction is a void method.when completed, the action associated to the actionFunctoin, we want to redirect the page from an https to an http page. In this case we tried to use oncomplete and use it to call an JS function. We tried different solutions
- window.top.location
- window.top.location.replace
- window.top.location.href
- or similar options offered by js and internet
the problem is that all this doesn't work.
We are using actionfunction
due to css issues that we have with commandButton
or commandLink
.
actually for the <apex:param>
we can redirect a generic element of the document, but we actually are not finding a solution to redirect a page using js oncomplete...
we are not understanding how to manage this and we also don't find a clear solution on web. Anyone can help us?
We found a WA but is something magic and is not smooth as solution, we dont like it.
Our WA is:
- instead of
<apex:param>
we use the html tag<input>
, this allows us to create params that you can get in the controller by calling with jquery the actionFunction giving these inputs as parameters. - when in the actioFunction we don't use the redirect parameter, this make the action function rerender all the page, and with the script below we are able to make the redirect:
<apex:outputPanel rendered="{!redirectPage}">
<script>
window.top.location.replace('http://....');
</script>
</apex:outputPanel>
where redirectPage
is a boolean parameter which is set in the controller...
we dont know how to understand better all the underlying the actionfunction component.
Can anyone explain us how to manage all of this in a smother way?
Note We do not have time to reengineer the code in such way to use RemoteActions.
actionFunction
and pass params to it that are then available in the controller. 2. Use the response from theactionFunction
to redirect the browser to another URL. Is this correct?