You need to sign in to do that
Don't have an account?
Dhairya
Java Script remoting
Marry Christmas Group!!!
I would like to use JS function on a cusotm link on a custom object. Developed below code for VF page
<apex:page controller="JSDetail"> <script type="text/javascript"> var name1="{!$CurrentPage.parameters.id}"; JSDetail.getDetail(name1,function(result,event){ alert(result.Expected_Attendes__c); alert(result.name); },{escape:true} ); </script> </apex:page>
and here is controller code
public with sharing class JSDetail { public static conference__c account; @RemoteAction public static conference__c getDetail(String iden){ account = [select name, Expected_Attendes__c from conference__c where id = :iden]; return account; } }
Now i created cutom link but not able to connect VF page with that link. Not sure why?
Appreciate your help
Hi,
You can directly call the controller method on the custom button by using Java Script remoting. You can place your page code in the custom button java script coding place.
If you want to call a page on the click on Custom button use The following steps
1. Select Behavior=Execute JavaScriptDisplay
2.Content Source=OnClick JavaScript
Enter the code in blank space window.location='/apex/pagename?id='+’{!objectid}’;
You will have to pass the object id in url .
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.