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
Mohan Raj 33Mohan Raj 33 

Can any one help to solve that isssue on the popup window doesn't appeare properway

My controller:
public class AccountEditController {
   
    accountwrapper1 makeEdit;
    List<accountwrapper1> listAccount = new List<accountwrapper1>();
    List<Account> selectableAccount = new List<Account>();
    List<Account> selectableAccount2 = new List<Account>();
    public Boolean showPopUp { get; set; }
   
   public AccountEditController() {
          showPopUp = False;
   }
    
    public List<accountwrapper1> getAccounts() {
            for(Account a: [SELECT Id, Name, BillingCountry, Phone FROM Account])
            listAccount.add(new accountwrapper1(a));
            return listAccount;            
    }
    
     public PageReference showToPopUp() {
        showPopUp = True;
         selectableAccount.clear();
        for(accountwrapper1 accwrapper : listAccount)
        if(accwrapper.selected == True)
        selectableAccount.add(accwrapper.acc);
        system.debug(selectableAccount);
        return Null;
    }
    
    public string BillingCountry {
        get; 
        set;
    }
    
    
    public PageReference Savemeth() {
        for(account acc :selectableAccount ) {
                acc.BillingCountry = BillingCountry;
                  selectableAccount2.add(acc);
        }    
    update selectableAccount2;
    return Null;
    
    }
    
    public PageReference cancelmeth() {        
        return Null;
    }

    public PageReference GetSelectedAccounts()
    {
       if(selectableAccount.size()>0) {
        system.debug(selectableAccount.size());
        system.debug(selectableAccount);
       return Null;
        }
        else
        return Null;
    } 
    
    
     public class accountwrapper1
    {             
        public Account acc{get; set;}      
        public Boolean selected {get; set;}
        public accountwrapper1(Account a)
        {
            acc = a;
            selected = False;
        }
    }
}

It's produce the error :Compile Error: unexpected token: 'showPopUp' at line 61 column 8

And my Page:
<apex:page controller="AccountEditController" applyHtmlTag="true">
    <apex:form >
        <apex:pageBlock Title="List of Accounts" >
           
               <apex:pageBlockButtons >
                    <apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
               </apex:pageBlockButtons>
               
             <!-- {!showPanel}---->
                  <apex:outputPanel id="Output" >
                       <apex:outputPanel rendered="{!showPopUp}">
                       <!---{!showPanel}---------->
                           <apex:outputLabel value="BillingCountry: "></apex:outputLabel>
                           <apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>                   
                           <apex:commandButton value="save" action="{!Savemeth}"/>
                           <apex:commandButton value="cancel" action="{!cancelmeth}"/>
                      
                        </apex:outputPanel>                   
                    </apex:outputPanel>  
                
               <apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
                        <apex:pageblockTable value="{!accounts}" var="a" >
                        
                            <apex:column headerValue="Select" width="60">
                                <apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
                            </apex:column>
                            
                            <apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
                            <apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
                            <apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
                                              
                        </apex:pageblocktable>
               </apex:pageBlockSection>
                
        </apex:pageblock>
    </apex:form>
</apex:page>

I don't get any error but there is no pop up window is to be generated for the  entering the billingcountry of the text box and the save / cancel  button. so please help me to solve that case for answers thanks in  advance.  
Best Answer chosen by Mohan Raj 33
Sergio AlcocerSergio Alcocer
You need to put the classes, and a little bit of change, something like ...
<style type="text/css">
	.PopupBackground{
		background-color:black;
		opacity: 0.20;
		filter: alpha(opacity = 20);
		position: absolute;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: 9998;
	}
	.AccountEdit{
		background-color: white;
		border-width: 2px;
		border-style: solid;
		z-index: 9999;
		left: 50%;
		padding:10px;
		position: absolute;
		width: 500px;
		margin-left: -250px;
		top:100px;
		opacity: 1;
	}
	</style>
	<apex:form >
		<apex:pageBlock Title="List of Accounts" >
			<apex:pageBlockButtons >
				<apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
			</apex:pageBlockButtons>
			 <!-- {!showPanel}---->
			 <apex:outputPanel id="Output" >
				<apex:outputPanel rendered="{!showPopUp}" styleClass="AccountEdit">
				<!---{!showPanel}---------->
					<apex:outputLabel value="BillingCountry: "></apex:outputLabel>
					<apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>
					<apex:commandButton value="save" action="{!Savemeth}"/>
					<apex:commandButton value="cancel" action="{!cancelmeth}"/>
					<apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>
				</apex:outputPanel>
				<!-- Background -->
				<apex:outputPanel rendered="{!showPopUp}" styleClass="PopupBackground"></apex:outputPanel>
			</apex:outputPanel>
			<!--   <apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>--->
			<apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
				<apex:pageblockTable value="{!accounts}" var="a" >
					<apex:column headerValue="Select" width="60">
						<apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
					</apex:column>
					<apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
					<apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
					<apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
				</apex:pageblocktable>
			</apex:pageBlockSection>
		</apex:pageblock>
	</apex:form>

 

All Answers

Sergio AlcocerSergio Alcocer
With your code, in my case it is generating a label, an input and two buttons before the table.

In order to get it as a "modal window" (not pop-up) you will have to play around with css, otherwise it is just another section on the document.

Kind regards
Mohan Raj 33Mohan Raj 33
@Sergio hi, Now I am rectify the error by the follwing code but itself also I doesn't get it the popup window with the text box and the save and cancel button. So if you know tha treason please tells the answer to get it.
My controller:
public class AccountEditController {
   
    accountwrapper1 makeEdit;
    List<accountwrapper1> listAccount = new List<accountwrapper1>();
    List<Account> selectableAccount = new List<Account>();
    List<Account> selectableAccount2 = new List<Account>();
    public Boolean showPopup { get; set; }
   
   public AccountEditController() {
          showPopup = False;
   }
    
    public List<accountwrapper1> getAccounts() {
            for(Account a: [SELECT Id, Name, BillingCountry, Phone FROM Account])
            listAccount.add(new accountwrapper1(a));
            return listAccount;            
    }
    
     public PageReference showToPopup() {
        showPopUp = True;
         selectableAccount.clear();
        for(accountwrapper1 accwrapper : listAccount)
        if(accwrapper.selected == True)
        selectableAccount.add(accwrapper.acc);
        system.debug(selectableAccount);
        return Null;
    }
    
    public string BillingCountry {
        get; 
        set;
    }
    
    
    public PageReference Savemeth() {
        for(account acc :selectableAccount ) {
                acc.BillingCountry = BillingCountry;
                  selectableAccount2.add(acc);
        }    
    update selectableAccount2;
    return Null;
    
    }
    
    public PageReference cancelmeth() {        
        return Null;
    }
    
    public PageReference closePopup() {
        showPopup = False;    
        return Null;
    }

    public PageReference GetSelectedAccounts()
    {
       if(selectableAccount.size()>0) {
        system.debug(selectableAccount.size());
        system.debug(selectableAccount);
       return Null;
        }
        else
        return Null;
    } 
    
    
     public class accountwrapper1
    {             
        public Account acc{get; set;}      
        public Boolean selected {get; set;}
        public accountwrapper1(Account a)
        {
            acc = a;
            selected = False;
        }
    }
}

 
Mohan Raj 33Mohan Raj 33
@Sergio if you want the page section as follow,
Page:
<apex:page controller="AccountEditController" applyHtmlTag="true">
    <style type="text/css">
    .PopupBackground{
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9998;
    }
    .AccountEdit{
        background-color: white;
        border-width: 2px;
        border-style: solid;
        z-index: 9999;
        left: 50%;
        padding:10px;
        position: absolute;
        width: 500px;
        margin-left: -250px;
        top:100px;
    }
    </style>
        <apex:form >
            <apex:pageBlock Title="List of Accounts" >
               
                   <apex:pageBlockButtons >
                        <apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
                   </apex:pageBlockButtons>
                   
                 <!-- {!showPanel}---->
                      <apex:outputPanel id="Output" >
                           <apex:outputPanel rendered="{!showPopUp}">
                           <!---{!showPanel}---------->
                               <apex:outputLabel value="BillingCountry: "></apex:outputLabel>
                               <apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>                   
                               <apex:commandButton value="save" action="{!Savemeth}"/>
                               <apex:commandButton value="cancel" action="{!cancelmeth}"/>
                               <apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>
                            </apex:outputPanel>                   
                        </apex:outputPanel>  
                 <!--   <apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>--->
                   <apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
                            <apex:pageblockTable value="{!accounts}" var="a" >
                            
                                <apex:column headerValue="Select" width="60">
                                    <apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
                                </apex:column>
                                
                                <apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
                                <apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
                                <apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
                                                  
                            </apex:pageblocktable>
                   </apex:pageBlockSection>
                    
            </apex:pageblock>
        </apex:form>
</apex:page>

 
Sergio AlcocerSergio Alcocer
You need to put the classes, and a little bit of change, something like ...
<style type="text/css">
	.PopupBackground{
		background-color:black;
		opacity: 0.20;
		filter: alpha(opacity = 20);
		position: absolute;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: 9998;
	}
	.AccountEdit{
		background-color: white;
		border-width: 2px;
		border-style: solid;
		z-index: 9999;
		left: 50%;
		padding:10px;
		position: absolute;
		width: 500px;
		margin-left: -250px;
		top:100px;
		opacity: 1;
	}
	</style>
	<apex:form >
		<apex:pageBlock Title="List of Accounts" >
			<apex:pageBlockButtons >
				<apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
			</apex:pageBlockButtons>
			 <!-- {!showPanel}---->
			 <apex:outputPanel id="Output" >
				<apex:outputPanel rendered="{!showPopUp}" styleClass="AccountEdit">
				<!---{!showPanel}---------->
					<apex:outputLabel value="BillingCountry: "></apex:outputLabel>
					<apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>
					<apex:commandButton value="save" action="{!Savemeth}"/>
					<apex:commandButton value="cancel" action="{!cancelmeth}"/>
					<apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>
				</apex:outputPanel>
				<!-- Background -->
				<apex:outputPanel rendered="{!showPopUp}" styleClass="PopupBackground"></apex:outputPanel>
			</apex:outputPanel>
			<!--   <apex:commandButton value="cancelPopUp" action="{!closePopUp}"/>--->
			<apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
				<apex:pageblockTable value="{!accounts}" var="a" >
					<apex:column headerValue="Select" width="60">
						<apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
					</apex:column>
					<apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
					<apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
					<apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
				</apex:pageblocktable>
			</apex:pageBlockSection>
		</apex:pageblock>
	</apex:form>

 
This was selected as the best answer