I have a requirement to create a custom button that will open a pop up window with some options to select. Currently i've built a VF page and called it from the custom button. But i need to expose this button in different detail page and if we call VF page from custom button, i need to use standard controller of one particular object..and cannot be reused for other related object. So i want the popup window to be opened when we execute onclick javascript from custom button, like : window.open=('/apex/newRic?id={{item.id}}','blank');
. But then i'm not able to add window open property to that button to specify the size of the popup
class:
public class test_k {
Public string s{
get;
set;
}
public test_k(ApexPages.StandardController controller) {
}
public List<SelectOption> getMatrix() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('None','----None----'));
list<Account_List_vod__c> pv= [select name,id from Account_List_vod__c];
for (Account_List_vod__c p:pv) {
options.add(new SelectOption(p.id,p.name));
}
return options;
}
public void addlineItem() {
newAccount_List_Item_vod__c(Account_vod__c='001Z000000yH6qg',Account_List_vod__c=s);
}
}
Page:
<apex:page standardController="Account" showHeader="false" extensions="test_k" sidebar="false">
<apex:form>
<apex:selectList value="{!s}" multiselect="false" size="1">
<apex:selectOptions value="{!Matrix}"/>
</apex:selectlist>
<apex:commandButton value="OK" action="{!addlineItem}"/>
</apex:form>
</apex:page>
Best Answer
If you want to use Javascript you will need to convert the button. Set the behaviour to "Execute JavaScript" and Content Source to "OnClick JavaScript"