You need to sign in to do that
Don't have an account?

Using Javascript (JQuery) in an Apex iframe
Hi,
In a visualforce I used an autocomplete feature (in JQeury) for an input field and that works great.
It's based on a remote action define in my controller which is called by the javascript.
Now, I want to put my visualforce in an apex iframe but when the frame is shown, the warning message : "Javascript proxies were not generated for controller myController : may not use public remoted methods inside an iframe".
And my apex remote action is of course never called.....
Do someone has an idea to resolve that ?
Thanks in advance for your help.
Hi,
I feel a little bit alone ;-)
So for those who experience this problem, simply declare as global:
- The controller of the Visualforce
- The method declared in remote action
If it can help someone, you're welcome ;-)
Enjoy !
All Answers
Can you post the code here? (as simply as possible)
Hi,
Thanks for your interest to help me.
So I tried to reduce the source code length as I can (see after) but with the elements below, you can put on a platform to test (just need jQuery as resource and JSONObject class).
Explanations for the operation :
- Visualforce page "Main" which is called manually (/apex/Main) and integrate inside an iframe
- Visualforce page "searchOpportunity" which is included in the iframe
- Apex controller "SearchOpportunityController" which is the controller of the page "searchOpportunity"
For the principle of autocomplete:
The user enters the characters (at least 3) the name of this opportunity and launcheda remoteaction in the controller which will then get a list of opportunities and thecorresponding display as a list in which the user can select the desired opportunity.
First I called the page "Main" (apex/Main), a warning (error) popup is displayed and apex remote action is never called :-(
Then I called the page "SearchOpportunity" (apex/SearchOpportunity), all works well :-) it's not enough....
But I need absolutely of course a Main page to integrate the page (as an iframe) in another GUI to integrate a sidebar, change the iframe source, etc...
Can you help me to resolve this restriction ?
Thanks in advance.
Visualforce "Main"
Visualforce "searchOpportunity"
Apex controller "SearchOpportunityController"
Hi,
Finally after many tests, I think I found the solution.
The warning (error) popup message has clearly oriented myself to the use of the "global" keyword and I found some complements on the 2 following pages:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting_example.htm
I'll let you know whether it works really well....
Hi,
I feel a little bit alone ;-)
So for those who experience this problem, simply declare as global:
- The controller of the Visualforce
- The method declared in remote action
If it can help someone, you're welcome ;-)
Enjoy !
You rock @frelep!!
Thanks!
I have a solution for this - it turns out Remoting doesn't work within iframes. Since "Development Mode" uses iframes, you can't use a public remote method if development mode is turned on for your user.
Turning off dev mode works around the issue, although I think this is clearly a salesforce bug that needs fixing.
thank you JamesAtCloudbuilders!!!
"clearly a salesforce bug that needs fixing" ... I completely agree.
Oh yeah, a bug to fix because current users like Sales for example should not have the "Developer mode" ;-)
Thanks! Needed this big time.
Spot on.
Thanks
I agree that this should be fixed. If I'm completely honest, I don't wish to turn my @RemoteAction method to global, especially since we cannot remove it afterwards.
I completely understand that the annotated method should only be used outside an iFrame, but this is within Salesforce's own iFrame. C'mon! :-)