function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohita KalraMohita Kalra 

I want get a new popup window for newcase creation on selection of a menuitem in a row

Hi, I need a popup screen of newcase(which we already have in salesforce) on select of a menuItem from a row and associate that case with one of the fields from selected row's parent? How can I achieve this ?
AbhishekAbhishek (Salesforce Developers) 
Hi Mohita,

Try this code

<apex:page standardController="Contact" extensions="PopupAlertController">
    <apex:form >
         <apex:pageBlock >
                  <apex:commandButton value="show Popup Alert" action="{!showPopup}" rerender="popup" status="status"/>
         <apex:outputPanel id="popup">
     <apex:outputPanel id="popInnerOutputPnl" styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
          <apex:commandButton value="X" title="Close the popup" action="{!closePopup}" styleClass="closeButton" rerender="popup"> </apex:commandButton>

                <apex:pageblockSection >
                        <apex:selectRadio value="{!Contact.Email}"> </apex:selectRadio><p/>
                        <apex:selectRadio value="{!Contact.Phone}"> </apex:selectRadio><p/>
                    <apex:selectRadio value="{!Contact.Email}"> </apex:selectRadio><p/>
        <apex:commandButton value="Ok" action="{!redirectPopup}" styleClass="closeButton" rerender="popup"> </apex:commandButton>

<style type="text/css">
.customPopup {
background-color: white;
border-style: solid;
border-width: 2px;
left: 20%;
padding: 10px;
position: absolute;
z-index: 9999;
/* These are the 3 css properties you will need to tweak so the popup displays in the center of the screen. First set the width.
Then set margin-left to negative half of what the width is. You can also add the height property for a fixed size pop up.*/
width: 500px;
top: 20%;

.disabledTextBox {
background-color: white;
border: 1px solid;
color: black;
cursor: default;
width: 90px;
display: table;
padding: 2px 1px;

.closeButton {
float: right;


public with sharing class PopupAlertController
    public Boolean displayPopup {get;set;}
    public PopupAlertController (ApexPages.StandardController controller)
    public void showPopup()
        displayPopup = true;
    public void closePopup()
         displayPopup = false;
    public List<SelectOption> getItems()
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('US','US'));
    options.add(new SelectOption('CANADA','Canada'));
    options.add(new SelectOption('MEXICO','Mexico')); return options;
    public PageReference redirectPopup()
    displayPopup = false;
    //Please uncomment below 3 statements and replace YourObjectId
    PageReference p=new Pagereference('/');
    return p;

For further reference,

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.