POP Up page:                                                                                                                                                                                                                                                                   controller: public class wrapperClassController  {  //Our collection of the class/wrapper objects cContact   public List contactList {get; set;}  public  List selectedContacts{get;set;}  public Integer value {get;set;}   public List getContacts()   {   if(contactList == null) {    contactList = new List();    for(Contact c : [select Id, Name, Email, Phone from Contact limit 10])     {    //As each contact is processed we create a new cContact object and add it to the contactList    contactList.add(new cContact(c));    }   }   return contactList;  }   public PageReference processSelected()  {   //We create a new list of Contacts that we be populated only with Contacts if they are selected     selectedContacts = new List();   //We will cycle through our list of cContacts and will check to see if the selected    //property is set to true, if it is we add the Contact to the selectedContacts list     for(cContact cCon : getContacts()) {     if(cCon.selected == true) {        selectedContacts.add(cCon.con);         }     }    value = selectedContacts.size();    System.debug('printing listcontc'+selectedContacts.size());    // Now we have our list of selected contacts and can perform any type of logic we want,    // sending emails, updating a field on the Contact, etc     return null;  }      public List getSelectedContacts() {  System.debug('printing listcontc inside get'+selectedContacts.size());  if(selectedContacts.size()>0)      return selectedContacts;  else return null; }  //This is our wrapper/container class. A container class is a class,a data structure,or an  //abstract data type whose instances are collections of other objects. In this example a   //wrapper class contains both the standard salesforce object Contact and a Boolean value  public class cContact  {  public Contact con {get; set;}  public Boolean selected {get; set;}  //This is the contructor method. When we create a new cContact object we pass a Contact   //that is set to the con property. We also set the selected value to false     public cContact(Contact c) {             con = c;             selected = false;         }     } } Please check it?  in this example to display selected contacts .  ", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T471YSAR", "datePublished": "2015-05-19T13:55:39.000Z", "author": { "@type": "Person", "name": "prasad yadav", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000BLWO9AAP", "affiliation": { "@type": "Organization", "name": "--" } } } ] } }
Skip to main content
prasad yadav ha fatto una domanda in #Visualforce
Hi Guys

Need Help

I have one requirement . in vf page i have two fileds one is add button. and antoher one textarea field. when ever i press add button to display popup on vfpage. in popup page  to display list of user and also check boxes. when ever i select one user using checkbox. and click on ok to display selected user in text area filed. How to acheive this.
4 risposte
  1. 19 mag 2015, 13:55
    Hi Ajay thanks for reply. in third action how to rendered data poppage to vf page.

    Iam trying fallowing code: 

    First VF Page:

    <apex:page sidebar="false">

    <script type="text/javascript">

    function myPopup2() {

    window.open( "/apex/DisplaySelectRecPageBloc", "myWindow", "status = 1, height = 400, width = 400, resizable = 1" )

    }

    </script>

     <apex:form >

         <apex:pageBlock >

             <apex:commandButton value="Add" onclick="myPopup2()" reRender="out"/>   

         </apex:pageBlock>

         <apex:pageBlock >

            <apex:inputTextarea id="us">

              </apex:inputTextarea>

          </apex:pageBlock>

     </apex:form>

    </apex:page>

    POP Up page:

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

        <apex:form >

             <apex:pageBlock >

                <apex:pageBlockButtons location="bottom">

                    <apex:commandButton value="Process Selected"  rerender="test"/>

                        <apex:actionFunction name="USER SELECT" action="{!processSelected}" rendered="out" status="stus" reRender="us"/>

                </apex:pageBlockButtons>

            <!-- In our table we are displaying the cContact records -->

                <apex:pageBlockTable value="{!contacts}" var="c" >

                    <apex:column >

                        <!-- This is our selected Boolean property in our wrapper class -->

                        <apex:inputCheckbox value="{!c.selected}"/>

                    </apex:column>

                <!-- This is how we access the contact values within our cContact container/wrapper -->

                    <apex:column value="{!c.con.Name}" />

                    <apex:column value="{!c.con.Email}" />

                    <apex:column value="{!c.con.Phone}" />

                </apex:pageBlockTable>

            </apex:pageBlock>

           <!-- <apex:pageBlock id="test">

            Total No of Selected Records :<apex:outputText value="{!value }"/>

                <apex:pageBlockTable value="{!SelectedContacts}" var="c" >

                    <apex:column value="{!c.Name}" />

                    <apex:column value="{!c.Email}" />

                    <apex:column value="{!c.Phone}" />

                </apex:pageBlockTable>

                

            </apex:pageBlock>----->

        </apex:form>

    </apex:page>

    controller:

    public class wrapperClassController 

    {

     //Our collection of the class/wrapper objects cContact 

     public List<cContact> contactList {get; set;}

     public  List<Contact> selectedContacts{get;set;}

     public Integer value {get;set;} 

     public List<cContact> getContacts() 

     {

      if(contactList == null) {

       contactList = new List<cContact>();

       for(Contact c : [select Id, Name, Email, Phone from Contact limit 10]) 

       {

       //As each contact is processed we create a new cContact object and add it to the contactList

       contactList.add(new cContact(c));

       }

      }

      return contactList;

     }  

    public PageReference processSelected()

     {

      //We create a new list of Contacts that we be populated only with Contacts if they are selected 

       selectedContacts = new List<Contact>();

      //We will cycle through our list of cContacts and will check to see if the selected 

      //property is set to true, if it is we add the Contact to the selectedContacts list 

       for(cContact cCon : getContacts()) {

        if(cCon.selected == true) {

           selectedContacts.add(cCon.con);

            }

        }

       value = selectedContacts.size();

       System.debug('printing listcontc'+selectedContacts.size());

       // Now we have our list of selected contacts and can perform any type of logic we want,

       // sending emails, updating a field on the Contact, etc 

       return null;

     }

        

    public List<Contact> getSelectedContacts()

    {

     System.debug('printing listcontc inside get'+selectedContacts.size());

     if(selectedContacts.size()>0)

         return selectedContacts;

     else return null;

    }

     //This is our wrapper/container class. A container class is a class,a data structure,or an

     //abstract data type whose instances are collections of other objects. In this example a 

     //wrapper class contains both the standard salesforce object Contact and a Boolean value 

    public class cContact 

    {

     public Contact con {get; set;}

     public Boolean selected {get; set;}

     //This is the contructor method. When we create a new cContact object we pass a Contact 

     //that is set to the con property. We also set the selected value to false 

     

     public cContact(Contact c) {

                con = c;

                selected = false;

            }

        }

    }

    Please check it?  in this example to display selected contacts .

     
0/9000