Timeline for Call a method with parameters from script in a Visualforce page
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 22, 2014 at 14:19 | comment | added | Keith C | @DavidRenz Thats good. Well worth learning about the JavaScript tools built in your browser if you are going to do client-side work. | |
Apr 22, 2014 at 14:15 | vote | accept | David Renz | ||
Apr 22, 2014 at 14:14 | comment | added | David Renz | Great, it works. Thank you very much Keith. You saved a lot of work for me. | |
Apr 22, 2014 at 14:10 | comment | added | Keith C | @DavidRenz My fault - I had a spurious "new" before the callback function. I've removed it from the answer now. That should correct the parameter count. | |
Apr 22, 2014 at 14:09 | history | edited | Keith C | CC BY-SA 3.0 |
Delete spurious new
|
Apr 22, 2014 at 14:02 | comment | added | David Renz |
I used the JavaScript Console of Chrome and found this error: Visualforce Remoting: Parameter length does not match remote action parameters: expected 2 parameters, got VFRemote.js:116
|
|
Apr 22, 2014 at 13:57 | comment | added | Keith C | @DavidRenz Yeah you will not see any output directly after the ExpenseCtrlExt.findLocation call; return values are available some time later (asynchronously) inside the callback function. So your alert should display the return value (or perhaps the return value wrapped in something; if the latter you can use alert(JSON.stringify(result)) to show the structure). So you must update your input field from inside that callback. | |
Apr 22, 2014 at 13:51 | comment | added | Keith C | @DavidRenz OK. Next thing to look at is the remote call. In Chrome the "Developer Tools" include a "Network" tab. If you click the round "Record Network Log" button at the top left of this tab and then test, you should see an "apexremote" log that if you click on you can check the request and response and perhaps see any error there. | |
Apr 22, 2014 at 13:43 | comment | added | David Renz | Yes, I also tried a alert right before the method gets called in the script and a debug output right after the method was called in the apex code. I get the alert, but i did not get the debug output. The method call looks like this: ExpenseCtrlExt.findLocation(city, country, new function(result, event) {});) | |
Apr 22, 2014 at 13:31 | comment | added | Keith C | @DavidRenz I presume you mean you added debug output to your Apex? Have you confirmed that there are no errors in your browser's JavaScript console and that the MyController.findLocation is called there. (You can use console.log to output debug output on the client side.) | |
Apr 22, 2014 at 13:26 | comment | added | David Renz | I tried it that way, but the findLocation in my controller was never called. I put some debug statements at the beginning of the method, but nothing happens. | |
Apr 22, 2014 at 13:06 | history | edited | Keith C | CC BY-SA 3.0 |
added 2 characters in body
|
Apr 22, 2014 at 13:00 | history | answered | Keith C | CC BY-SA 3.0 |