Created
May 16, 2012 20:00
-
-
Save futurehope/2713502 to your computer and use it in GitHub Desktop.
Visualforce.remoting.Manager.invokeAction bring used correctly? 0,1,2 works in spring12, only single argument works in summer 12 with new method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class RemoteController { | |
@RemoteAction | |
global static String test0Str(){ | |
return '0 arguments'; | |
} | |
@RemoteAction | |
global static String test1Str(String str){ | |
return str; | |
} | |
@RemoteAction | |
global static String test2Str(String str1,String str2){ | |
return str1+ ' ' + str2; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="RemoteController" > | |
<script> | |
function handleReturn(result, event) { | |
if (event.status) { | |
document.getElementById("output").innerHTML = result + ', ' + document.getElementById("output").innerHTML; | |
} else if (event.type === 'exception') { | |
document.getElementById("output").innerHTML = event.message; | |
} else { | |
document.getElementById("output").innerHTML = event.message; | |
} | |
} | |
</script> | |
<div id="output" /> | |
<form > | |
<div> | |
<input value="summer12 0 params" onclick="Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test0Str}', handleReturn,{escape: true})" type="button" /> | |
<input value="spring12 0 params" onclick="RemoteController.test0Str( handleReturn,{escape: true})" type="button" /> | |
</div> | |
<div> | |
<input value="summer12 1 params" onclick="Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test1Str}','1 argument', handleReturn,{escape: true})" type="button" /> | |
<input value="spring12 1 params" onclick="RemoteController.test1Str('1 argument', handleReturn,{escape: true})" type="button" /> | |
</div> | |
<div> | |
<input value="summer12 2 params" onclick="Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test2Str}','2','arguments', handleReturn,{escape: true})" type="button" /> | |
<input value="spring12 2 params" onclick="RemoteController.test2Str('2','arguments', handleReturn,{escape: true})" type="button" /> | |
</div> | |
</form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answer here - https://developer.salesforce.com/forums?id=906F000000097yIIAQ, multiple parameters do work. It was a bug, might have been fixed.