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

Disable the picklist when after selecting the value in picklaist

Hi all,

 i wrote this class for selecting particualr value in picklist then display the popup.Once enter the value in to popup and save that value then popup disappears.this is ok.But whenever the popup disappears. then picklist also closed.Any one can u please help me this.


public class pageController {
public string fname{set;get;}
public class customField {

public String fieldType { get; set; }
public String flagForDeletion { get; set; }
private String Value;
public String getTextValue() { return value; }
public String getCheckValue() { return value; }
public String getTextAreaValue() { return value; }
public void setTextValue(String s) { value = s; }
public void setCheckValue(String s) { value = s; }
public void setTextAreaValue(String s) { value = s; }
public Boolean getIsText() { return fieldType == 'text'; }
public Boolean getIsCheck() { return fieldType == 'check'; }
public Boolean getIsTextArea() { return fieldType == 'area'; }
public List<SelectOption> getDataTypeList() {
List<SelectOption> dataTypes = new List<SelectOption>();
dataTypes.add(new SelectOption('--Select--','--Select--'));
dataTypes.add(new SelectOption('text','Text Field'));
dataTypes.add(new SelectOption('check','Checkbox'));
dataTypes.add(new SelectOption('area','Text Area'));
return dataTypes;

public List<customField> fieldList { get; set; }

public pageController() {
fieldList = new List<customField>();

public void addRow() {
customField cf = new customField();
cf.fieldType = '--Select--';
cf.flagForDeletion = 'false';

public void delRows() {
for(Integer i = fieldList.size()-1; i>=0; i--) {
if(fieldList[i].FlagForDeletion == 'true') {

public boolean displayPopup {get; set;}

public void closePopup() {
displayPopup = false;
public void showPopup() {
displayPopup = true;



<apex:page controller="pageController" sidebar="false" showHeader="false">

<style type="text/css">
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
position: absolute;
/* These are the 3 css properties you will need to change 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 add
the height property for a fixed size pop up if you want.*/
width: 500px;
margin-left: -250px;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;


<apex:form id="theForm">
<apex:outputpanel >
<apex:dataTable columns="1" value="{!fieldList}" var="field">
<apex:column >
<apex:inputCheckbox value="{!field.flagfordeletion}" />
<apex:outputpanel >
<apex:selectList value="{!field.fieldtype}" size="1">
<apex:selectOptions value="{!field.datatypelist}" />
<apex:actionSupport event="onchange" reRender="theForm" action="{!showPopup}"/>
<apex:inputText value="{!field.textvalue}" rendered="{!field.istext}" >{!fname}</apex:inputtext>
<apex:inputTextarea value="{!field.textareavalue}" rendered="{!field.istextarea}" ></apex:inputtextarea>
<apex:inputCheckbox value="{!field.checkvalue}" rendered="{!field.ischeck}" ></apex:inputCheckbox>
</apex:dataTable><br />
<apex:commandButton action="{!addrow}" value="Add Field"/>
<apex:commandButton action="{!delRows}" value="Delete Selected Field"/>

<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:pageBlock >
<apex:pageblocksection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Field Name">
<apex:inputtext value="{!fname}"/>

<apex:commandButton value="save" action="{!closePopup}" rerender="tstpopup"/>




Thanks in advance.




   plaese write Rendred property in page.


<apex:selectList value="{!field.fieldtype}" size="1" rendred="{!enable}">
<apex:selectOptions value="{!field.datatypelist}" />
<apex:actionSupport event="onchange" reRender="theForm" action="{!showPopup}"/>


Declare Boolean variable

Public Boolean Enable{get;set;}

In constructor please assign Enable = true;

Now In showPopup() or function for Save button in poup , assign Enable = false;


Did this post solve your problem If so please mark it solved so that It ca be refered later .