You need to sign in to do that
Don't have an account?

How to display Account details like few fields ie name, phone from Accounts when i click a button
hi all ,
in a vf page , i have a custom button , if i click that button i need to get a pop up which displays all account fields name, phone with a check box in a column . can you please give me an example how to do this ??
in a vf page , i have a custom button , if i click that button i need to get a pop up which displays all account fields name, phone with a check box in a column . can you please give me an example how to do this ??
Hi,
Please save class and vf page after that click on 'preview' button and writedown in url as like this
https://c.ap2.visual.force.com/apex/AccDetail?id=0012800000lXwWx
above id is account id.Now you will see data off account inside popup after button click.
Please mark it as a best answer.
Thanks,
Dileep
All Answers
Hi,
Please save class and vf page after that click on 'preview' button and writedown in url as like this
https://c.ap2.visual.force.com/apex/AccDetail?id=0012800000lXwWx
above id is account id.Now you will see data off account inside popup after button click.
Please mark it as a best answer.
Thanks,
Dileep
below is my code, when i click on " show pop up " button i am not getting anything , can you please let me know whats the issue i am facing .
if i remove all the wrapper and just display the pageblock table i am able to see the account details
controller :
public class PopUpVfTableCont
{
public list<account> acclist {get;set;}
public boolean displayPopup {get; set;}
public list<popupwrapper> popwrap {get;set;}
public void showpopup()
{
acclist = new list<account>();
acclist = [select id ,name , phone from account limit 5];
for(Account ac:acclist)
{
popwrap.add(new popupwrapper(false ,ac) );
displayPopup = true;
}
// displayPopup = true;
}
public void hidepopup()
{
displayPopup = false;
}
public class popupwrapper
{
public boolean checkbox{get;set;}
public Account act{get;set ;}
public popupwrapper(boolean c,Account a )
{
checkbox =c ;
act = a;
}
}
}
vf page :
<apex:page controller="PopUpVfTableCont">
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
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: -100px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="PopUpCont"/>
<apex:pageBlock >
<apex:outputPanel id="PopUpCont">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:pageBlockTable value="{!popwrap}" var="wrap">
<apex:column value="{!wrap.act.Name}"/>
<apex:column value="{!wrap.act.Phone}"/>
<apex:column headerValue="Checkbox">
<apex:inputCheckbox value="{!wrap.checkbox }"/>
</apex:column>
</apex:pageBlockTable>
<apex:commandButton value="Hide Pop up" action="{!hidepopup}" rerender="PopUpCont"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>