• Sophia G
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies
Hi,

Could someone please help me with the code to pass the selected record from a list on visualforce page 1, to a registration form on  visualforce page 2. I need this record to populate into the lookup field on the second visualforce page "Division". These fields have a Master Detail relationship (the Division is Master, Competitor is child) Please see below. I have been struggling with this and can't figure out the correct code.
 
VISUALFORCE PAGE 1:

<apex:page controller="NFOSController">
     
    <apex:form >
        <apex:pageBlock title="Division Types">
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!NFOS1}" value="Add Competitor" rerender="PB1,PB2"/>
            </apex:pageBlockButtons>
           <apex:pageBlockTable value="{!divList}" var="divWrapper">
                <apex:column >
               <apex:inputCheckbox value="{!divWrapper.isSelected}"/>
            </apex:column> 
            <apex:column value="{!divWrapper.cDivision.Name}"/>
            <apex:column value="{!divWrapper.cDivision.Availability__c}"/>
                <apex:column value="{!divWrapper.cDivision.Number_of_Competitors__c}"/>
                <apex:column value="{!divWrapper.cDivision.Active__c}"/>
               <apex:column value="{!divWrapper.cDivision.Id}"/>
         </apex:pageBlockTable>
                   
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
VISUALFORCE PAGE 2

<apex:page standardcontroller="Competitor2__c" extensions="NFOSController" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
		     <apex:pageBlockButtons location="bottom">
              <apex:commandButton value="Save" action="{!save}"/>
		        </apex:pageBlockButtons>
				
			<apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
                <apex:inputField value="{!comp.Name}" required="false"/>
				<apex:inputField value="{!comp.Division_Space__c}" required="false"/>
                <apex:inputField value="{!comp.First_Name__c}" required="false"/>
				<apex:inputField value="{!comp.Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!comp.Lastname__c}" required="false"/>
				<apex:inputField value="{!comp.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
				<apex:inputField value="{!comp.Email_Address__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Phone_Number__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Street_Address__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Suburb__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.State__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Postcode__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Country__c}" required="false"/>
				<apex:pageBlockSectionItem />
                <apex:inputField value="{!comp.Id}" required="false"/>
			</apex:pageBlockSection>	
   
      			
		</apex:pageBlock>
	</apex:form>
</apex:page>
 
CONTROLLER

public with sharing class NFOSController {
    
   
     public Competitor2__c comp{get;set;}
     public List<DivisionWrapper> divList {get;set;}
     public Set<String> selDivisionNames {get;set;}
     public Boolean hasSelDiv {get;set;}
    

     
     public NFOSController(){
          DivList = new List<DivisionWrapper>();
          selDivisionNames = new Set<String>();

          for(Division_Space2__c d : [SELECT Id, Name, Availability__c, Number_of_Competitors__c, Active__c
          FROM Division_Space2__c WHERE Name!= NULL 
          LIMIT 5]){
               divList.add(new DivisionWrapper(d));
              
              comp= new Competitor2__c();
          }
     }
     public PageReference save()
    {
        if(comp.Name != null){
            insert comp;
          
        }       
        return stdController.save();
    }
    
   
     public void displaySelectedDivisionNames(){
          selDivisionNames.clear();
          hasSelDiv = false;
          for(DivisionWrapper cWrapper : divList){
               if(cWrapper.isSelected){
                    hasSelDiv = true;
                    selDivisionNames.add(cWrapper.cDivision.Name);
               }
          }
              }
      public PageReference NFOS1() {
        ApexPages.currentPage().getParameters().get('Id')
        ;PageReference pageRef = new PageReference('/apex/NFOS1');
        pageRef.setRedirect(false);
        return pageRef; 
      }
    public NFOSController(ApexPages.StandardController stdController)
    { 
         this.comp = (Competitor2__c)stdController.getRecord();
        this.stdController = stdController;
    } 
    ApexPages.StandardController stdController;
    
         
     public class DivisionWrapper {
     public Boolean isSelected {get;set;}
     public Division_Space2__c cDivision {get;set;}

     public DivisionWrapper(Division_Space2__c cDivision){
          this.cDivision = cDivision;
     }
     }
}
Hi,
How can I create a  visualforce page that replicates the list view of my custom object records, and the functionality of being able to select a record and then use the action button to add a New Competitor to this record and to populate the record that I have selected. Please see below.

User-added image

User-added imageI have create numerous visualforce pages in an attempt to replicate this functionality (where the Division is pulled through to the form) but nothing seems to be working. The Division is the master and the Competitor is the child in the master-detail relationship of the field "Division".

Thanks
Hi,

How can I pass a field value from one visualforce page to another. They have the same controller but are too different objects. They have a master-detail relationship. The Division is the master, and the Competitor is the child. I am trying to pass the field value "Name" from page 1, to Division_Space__c in page 2.

Page1:
<apex:page controller="NFOSController">
    <apex:form >
        <apex:pageBlock title="Division Types">
         
            <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Show Selected Divisions" action="{!displaySelectedDivisionNames}"/>
            <apex:commandButton action="{!gotoNFOS1}" value="Add Competitor" rerender="PB1,PB2"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!divList}" var="divWrapper">
                <apex:column >
               <apex:inputCheckbox 
                 value="{!divWrapper.isSelected}"/>
            </apex:column> 
            <apex:column 
              value="{!divWrapper.cDivision.Name}"/>
            <apex:column 
              value="{!divWrapper.cDivision.Availability__c}"/>
                <apex:column 
              value="{!divWrapper.cDivision.Number_of_Competitors__c}"/>
                <apex:column 
              value="{!divWrapper.cDivision.Active__c}"/>
         </apex:pageBlockTable>
            
            <apex:pageBlockSection >
            <apex:outputPanel 
              layout="block" 
              rendered="{!hasSelDiv}">
               <apex:outputText 
                 value="Below are the selected Divisions:"/>
               <br/>
               <apex:outputText 
                 value="{!selDivisionNames}"/>
             </apex:outputPanel>
             <apex:outputPanel layout="block" 
               rendered="{!NOT(hasSelDiv)}">
                <br/>
                <apex:outputText value="No Division selected."/>
             </apex:outputPanel>
         </apex:pageBlockSection>
        
        </apex:pageBlock>
    </apex:form>
</apex:page>
Page 2:
<apex:page standardcontroller="Competitor2__c" extensions="NFOSController" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
		     <apex:pageBlockButtons location="bottom">
		        <apex:commandButton value="Save" action="{!save}"/>
		        </apex:pageBlockButtons>
						
			<apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
				<apex:inputField value="{!comp.Name}" required="false"/>
				<apex:inputField value="{!comp.First_Name__c}" required="false"/>
				<apex:inputField value="{!comp.Division_Space__c}" required="true"/>
				<apex:inputField value="{!comp.Lastname__c}" required="false"/>
				<apex:inputField value="{!comp.Date_of_Birth__c}" required="false"/>
				<apex:inputField value="{!comp.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
				<apex:inputField value="{!comp.Email_Address__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Phone_Number__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Street_Address__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Suburb__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.State__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Postcode__c}" required="false"/>
				<apex:pageBlockSectionItem />
				<apex:inputField value="{!comp.Country__c}" required="false"/>
				<apex:pageBlockSectionItem />
			</apex:pageBlockSection>			
			
		</apex:pageBlock>
	</apex:form>
</apex:page>

Controller:
public class NFOSController {
    
   // PROPERTIES
     public Competitor2__c comp{get;set;}
     public List<DivisionWrapper> divList {get;set;}
     public Set<String> selDivisionNames {get;set;}
     public Boolean hasSelDiv {get;set;}

     // CONSTRUCTOR
     public NFOSController(){
          DivList = new List<DivisionWrapper>();
          selDivisionNames = new Set<String>();

          for(Division_Space2__c d : [SELECT Name, Availability__c, Number_of_Competitors__c, Active__c
          FROM Division_Space2__c WHERE Name!= NULL 
          LIMIT 5]){
               divList.add(new DivisionWrapper(d));
              
              comp= new Competitor2__c();
          }
     }
     public PageReference save()
    {
        if(comp.Name != null){
            insert comp;
          
        }       
        return stdController.save();
    }
    
     // METHODS
     public void displaySelectedDivisionNames(){
          selDivisionNames.clear();
          hasSelDiv = false;
          for(DivisionWrapper cWrapper : divList){
               if(cWrapper.isSelected){
                    hasSelDiv = true;
                    selDivisionNames.add(cWrapper.cDivision.Name);
               }
          }
              }
      public PageReference gotoNFOS1() {
        return Page.NFOS1;
      }
    public NFOSController(ApexPages.StandardController stdController)
    { 
         this.comp = (Competitor2__c)stdController.getRecord();
        this.stdController = stdController;
    } 
    ApexPages.StandardController stdController;
    
    //WRAPPER CLASS       
     public class DivisionWrapper {
     public Boolean isSelected {get;set;}
     public Division_Space2__c cDivision {get;set;}

     public DivisionWrapper(Division_Space2__c cDivision){
          this.cDivision = cDivision;
     }
     }
}


 
Hi,
I have 2 Visualforce pages that I would like to share the 1 controller. The first page which is already connected to the controller is a list, and the second page is a registration form. How would I add the registration form to the controller?
Thank you

Page 1:
<apex:page controller="NFOSController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Availability__c}"/>
                <apex:column value="{!a.Number_of_Competitors__c}"/>
                <apex:column value="{!a.Active__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class NFOSController {

    public List<Division_Space2__c> accs {
        get {
            if (accs == null) accs = [select name, Availability__c, Number_of_Competitors__c, Active__c from Division_Space2__c limit 1000];
            return accs;
        }
        set;
    }
}
​​​​​​​
Page 2:
<apex:page standardController="Competitor2__c" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
             <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
             </apex:pageBlockButtons>
                        
            <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
                <apex:inputField value="{!Competitor2__c.Name}" required="false"/>
                <apex:inputField value="{!Competitor2__c.First_Name__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Division_Space__c}" required="true"/>
                <apex:inputField value="{!Competitor2__c.Lastname__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Email_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Phone_Number__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Street_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Suburb__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.State__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Postcode__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Country__c}" required="false"/>
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>            
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Hi,

Could someone please tell me how I can add Apex cookies into my already formed Wrapper (I am trying to pass a field value from one visualforce page to another and they don't share a controller). I'm having alot of trouble with this.

Controller 1: NFOSDisplayDivisionsController
public class NFOSDisplayDivisionsController {
    
    public List<WrapDivision> wrapDivisionList { get; set; }
    public List<Division_Space2__c> selectedDivisions{get;set;}        
    public Division_Space2__c division {get;set;}   
       
    public NFOSDisplayDivisionsController() {                              
        selectedDivisions = new List<Division_Space2__c>(); 
       if(wrapDivisionList ==null){
          wrapDivisionList =new list<WrapDivision>();
          for(Division_Space2__c b:[select Name, Availability__c, Number_of_Competitors__c, Active__c From Division_Space2__c limit 300]){
           wrapDivisionlist.add(new wrapDivision(b));          
           }                       
        }
 }
 public PageReference NFOSDisplayDivisions() {
   return Page.NFOSDisplayDivisions;
 }
     public PageReference NFOSDisplayDivisions1() {
        selectedRecords();        //this method was added so that only NFOSDisplayDivisions1 button will be clicked        
        return Page.NFOSDisplayDivisions1;
    }
  public void selectedRecords(){
     selectedDivisions =new List<Division_Space2__c>();     
      for(WrapDivision wra : wrapDivisionlist){
           if(wra.isSelected == true){
           selectedDivisions.add(wra.wbk);
           }                 
         }
    }
    public PageReference cancel() {
           PageReference NFOSDisplayDivisions = new ApexPages.StandardController(division).view();
           NFOSDisplayDivisions.setRedirect(true);
            return NFOSDisplayDivisions; 
    } 
 public PageReference Save() {       
       upsert selectedDivisions;
           return null;   
 }
    public PageReference gotoNFOSDIVISION() {
    return Page.NFOSDIVISION;
    
}

    public class WrapDivision {    
    public Division_Space2__c wbk {get;set;}
    public boolean isSelected {get;set;}
     
       public WrapDivision(Division_Space2__c b){     
         wbk=b;
         isselected=false;
       }
  }

}

Controller 2: NFOSDIVISIONController
public class NFOSDIVISIONController

{
             
    public final Competitor2__c comp {get; set;}
    
    public PageReference save()
    {
        if(comp.Name != null){
            insert comp;
          
        }
       
        return stdController.save();
    }
    public NFOSDIVISIONController(ApexPages.StandardController stdController)
    { 
        
        this.comp = (Competitor2__c)stdController.getRecord();
        this.stdController = stdController;
    } 
    ApexPages.StandardController stdController;
}
Hi,
Could someone give me a hand with writing the code to pass the field "Division Name" (api = Name) from one Visualforce page to another (from a list to a registration form)? They don't share the same controller. Pass from NFOSDisplayDivisions1 to NFOSDIVISION.
Thank you

NFOSDisplayDivisions1:
<apex:page controller="NFOSDisplayDivisionsController">
 
<script>
  function confirmCancel() {
      var isCancel = confirm("Are you sure you wish to cancel?");
      if (isCancel) return true;
  
     return false;
  }  
  </script>
 
 <apex:form >
     
 <apex:pageBlock >
     
  <apex:pageBlockButtons location="top" >
  <apex:commandButton action="{!NFOSDisplayDivisions}" value="Back" id="next1"/>
  <apex:commandButton action="{!gotoNFOSDIVISION}" value="Add New Competitor" rerender="PB1,PB2"/>
  <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" id="cancel"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!selectedDivisions}" var="sb" id="theBlock">
            <apex:column headerValue="Division Name">
            <apex:outputField value="{!sb.Name}"/>
            </apex:column>
            <apex:column headerValue="Availability">
            <apex:inputField value="{!sb.Availability__c}"/>
            </apex:column>
            <apex:column headerValue="Number of Competitors">
           <apex:inputField value="{!sb.Number_of_Competitors__c}"/>
           </apex:column>
           <apex:column headerValue="Active">
           <apex:inputField value="{!sb.Active__c}"/>
           </apex:column>
           </apex:pageBlockTable>    
       </apex:pageBlock>
      
       </apex:form>
</apex:page>

NFOSDIVISION:
<apex:page standardController="Competitor2__c" extensions="NFOSDIVISIONController" lightningStylesheets="true">
               
    <style>
    input[type=text] {
    width: 150px;
    display: block;
    margin-bottom: 10px;
    background-color: white;
    }

   </style>
   
    <apex:sectionHeader title="Noosa Festival of Surfing" />
    <apex:form id="NFOSDIVISION"> 
    <apex:pageBlock title="New Competitor" mode="edit">
        
        <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
            <apex:inputField value="{!acct.Name}" required="false"/>
            <apex:inputField value="{!acct.First_Name__c}" required="true" />
            <apex:inputField value="{!acct.Lastname__c}" required="true" />
            <apex:inputField value="{!acct.Date_of_Birth__c}" required="true" />
            <apex:inputField value="{!acct.Email_Address__c}" required="true" />
            <apex:inputField value="{!acct.Phone_Number__c}" required="false" />
            <apex:inputField value="{!acct.Street_Address__c}" required="true" />
            <apex:inputField value="{!acct.Suburb__c}" required="true" />
            <apex:inputField value="{!acct.Division_Space__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.State__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Postcode__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Country__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Waiver_Read_T_Cs_Accepted__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:commandButton value="Submit" action="{!save}"/>
        </apex:pageBlockSection>
       
        </apex:pageBlock> 
</apex:form> 
</apex:page>
Hi,
I am having trouble with my Visualforce page and Apex Class. Everything seems to be fine apart from the error Unknown Property 'NFOSDisplayDivisions2Controller.Division_Space2__c'. I can't seem to figure out what is going on, could someone please help me out. Thank you.

Apex Class:
public with sharing class NFOSDisplayDivisions2Controller {
    
    public List<DivisionWrapper> listDivisionWrapper{get;set;}
    public List<Division_Space2__c> selectedDivisions{get;set;}

    public NFOSDisplayDivisions2Controller ()
    {
            listDivisionWrapper = new List<DivisionWrapper>();
            searchRecord();
    }
    
    public void searchRecord()
    {
        listDivisionWrapper.clear();
            for(Division_Space2__c a: [select Id, Name,Number_of_Competitors__c, Availability__c, RecordTypeID ,Active__c from Division_Space2__c limit 30]) 
            {
                listDivisionWrapper.add(new DivisionWrapper(a));
            }
    }

    public void processSelected() 
    {
        selectedDivisions = new List<Division_Space2__c>();
        selectedDivisions.clear();
        for(DivisionWrapper wrapDivisionObj : listDivisionWrapper) 
        {
            if(wrapDivisionObj.selected == true) 
            {
                selectedDivisions.add(wrapDivisionObj.acc);
                // Here you can add the counter or you check the selectedAccounts.size()
            }
        }
    }

    public void ActivateData() 
    {
        for(Division_Space2__c acc : selectedDivisions )
        {
            acc.Active__c= true;
        }
        update selectedDivisions ;
        searchRecord();
    }

    public void DeActivateData() 
    {
        for(Division_Space2__c acc : selectedDivisions )
        {
            acc.Active__c = false;
        }
        update selectedDivisions ;
        searchRecord();
    }
    


    // This is our wrapper/container class. 
    public class DivisionWrapper 
    {
        public Division_Space2__c acc {get;set;}
        public Boolean selected {get;set;}
        public DivisionWrapper(Division_Space2__c a) 
        {
            acc = a;
            selected = false;
        }
    }

}

Visualforce Page:
<apex:page controller= "NFOSDisplayDivisions2Controller">
    
<script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock id="PB1">
            <apex:pageBlockButtons >
                <apex:commandButton value="Add to Grid" action="{!processSelected}" rerender="table2,PB2"/>
            </apex:pageBlockButtons>

            <apex:pageblockSection title="Division Types" collapsible="false" columns="1">
                <apex:pageBlockTable value="{!listDivisionWrapper}" var="accWrap" id="table" title="Division Types">
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!Division_Space2__c.acc.Name}" />
                    <apex:column value="{!Division_Space2__c.acc.Number_of_Competitors__c}" />
                    <apex:column value="{!Division_Space2__c.acc.Availability__c}" />
                    <apex:column value="{!Division_Space2__c.acc.Active__c}" />
                </apex:pageBlockTable>


            </apex:pageblockSection>
        </apex:pageBlock>
        
        <apex:pageBlock id="PB2" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Activate" action="{!ActivateData}" rerender="PB1,PB2"/>
                <apex:commandButton value="DeActivate" action="{!DeActivateData}" rerender="PB1,PB2"/>
            </apex:pageBlockButtons>

                <apex:pageBlockTable value="{!selectedDivisions}" var="c" id="table2" title="Selected Divisions">
                    <apex:column value="{!c.Name}" headerValue="Division Type"/>
                    <apex:column value="{!c.Number_of_Competitors__c}" headerValue="Number of Competitors"/>
                    <apex:column value="{!c.Availability}" headerValue="Availability"/>
                    <apex:column value="{!c.Active__c}" headerValue="Active"/>
                </apex:pageBlockTable>
        </apex:pageBlock>

        
    </apex:form>
</apex:page>
Hi,
I am having trouble with my Visualforce page and Apex Class. Everything seems to be fine apart from the error Unknown Property 'NFOSDisplayDivisions2Controller.Division_Space2__c'. I can't seem to figure out what is going on, could someone please help me out. Thank you.

Apex Class:
public with sharing class NFOSDisplayDivisions2Controller {
    
    public List<DivisionWrapper> listDivisionWrapper{get;set;}
    public List<Division_Space2__c> selectedDivisions{get;set;}

    public NFOSDisplayDivisions2Controller ()
    {
            listDivisionWrapper = new List<DivisionWrapper>();
            searchRecord();
    }
    
    public void searchRecord()
    {
        listDivisionWrapper.clear();
            for(Division_Space2__c a: [select Id, Name,Number_of_Competitors__c, Availability__c, RecordTypeID ,Active__c from Division_Space2__c limit 30]) 
            {
                listDivisionWrapper.add(new DivisionWrapper(a));
            }
    }

    public void processSelected() 
    {
        selectedDivisions = new List<Division_Space2__c>();
        selectedDivisions.clear();
        for(DivisionWrapper wrapDivisionObj : listDivisionWrapper) 
        {
            if(wrapDivisionObj.selected == true) 
            {
                selectedDivisions.add(wrapDivisionObj.acc);
                // Here you can add the counter or you check the selectedAccounts.size()
            }
        }
    }

    public void ActivateData() 
    {
        for(Division_Space2__c acc : selectedDivisions )
        {
            acc.Active__c= true;
        }
        update selectedDivisions ;
        searchRecord();
    }

    public void DeActivateData() 
    {
        for(Division_Space2__c acc : selectedDivisions )
        {
            acc.Active__c = false;
        }
        update selectedDivisions ;
        searchRecord();
    }
    


    // This is our wrapper/container class. 
    public class DivisionWrapper 
    {
        public Division_Space2__c acc {get;set;}
        public Boolean selected {get;set;}
        public DivisionWrapper(Division_Space2__c a) 
        {
            acc = a;
            selected = false;
        }
    }

}

Visualforce Page:
<apex:page controller= "NFOSDisplayDivisions2Controller">
    
<script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock id="PB1">
            <apex:pageBlockButtons >
                <apex:commandButton value="Add to Grid" action="{!processSelected}" rerender="table2,PB2"/>
            </apex:pageBlockButtons>

            <apex:pageblockSection title="Division Types" collapsible="false" columns="1">
                <apex:pageBlockTable value="{!listDivisionWrapper}" var="accWrap" id="table" title="Division Types">
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!Division_Space2__c.acc.Name}" />
                    <apex:column value="{!Division_Space2__c.acc.Number_of_Competitors__c}" />
                    <apex:column value="{!Division_Space2__c.acc.Availability__c}" />
                    <apex:column value="{!Division_Space2__c.acc.Active__c}" />
                </apex:pageBlockTable>


            </apex:pageblockSection>
        </apex:pageBlock>
        
        <apex:pageBlock id="PB2" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Activate" action="{!ActivateData}" rerender="PB1,PB2"/>
                <apex:commandButton value="DeActivate" action="{!DeActivateData}" rerender="PB1,PB2"/>
            </apex:pageBlockButtons>

                <apex:pageBlockTable value="{!selectedDivisions}" var="c" id="table2" title="Selected Divisions">
                    <apex:column value="{!c.Name}" headerValue="Division Type"/>
                    <apex:column value="{!c.Number_of_Competitors__c}" headerValue="Number of Competitors"/>
                    <apex:column value="{!c.Availability}" headerValue="Availability"/>
                    <apex:column value="{!c.Active__c}" headerValue="Active"/>
                </apex:pageBlockTable>
        </apex:pageBlock>

        
    </apex:form>
</apex:page>
Hi,
I have 2 Visualforce pages that I would like to share the 1 controller. The first page which is already connected to the controller is a list, and the second page is a registration form. How would I add the registration form to the controller?
Thank you

Page 1:
<apex:page controller="NFOSController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Availability__c}"/>
                <apex:column value="{!a.Number_of_Competitors__c}"/>
                <apex:column value="{!a.Active__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class NFOSController {

    public List<Division_Space2__c> accs {
        get {
            if (accs == null) accs = [select name, Availability__c, Number_of_Competitors__c, Active__c from Division_Space2__c limit 1000];
            return accs;
        }
        set;
    }
}
​​​​​​​
Page 2:
<apex:page standardController="Competitor2__c" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
             <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
             </apex:pageBlockButtons>
                        
            <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
                <apex:inputField value="{!Competitor2__c.Name}" required="false"/>
                <apex:inputField value="{!Competitor2__c.First_Name__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Division_Space__c}" required="true"/>
                <apex:inputField value="{!Competitor2__c.Lastname__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Email_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Phone_Number__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Street_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Suburb__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.State__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Postcode__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Country__c}" required="false"/>
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>            
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Hi,
Could someone give me a hand with writing the code to pass the field "Division Name" (api = Name) from one Visualforce page to another (from a list to a registration form)? They don't share the same controller. Pass from NFOSDisplayDivisions1 to NFOSDIVISION.
Thank you

NFOSDisplayDivisions1:
<apex:page controller="NFOSDisplayDivisionsController">
 
<script>
  function confirmCancel() {
      var isCancel = confirm("Are you sure you wish to cancel?");
      if (isCancel) return true;
  
     return false;
  }  
  </script>
 
 <apex:form >
     
 <apex:pageBlock >
     
  <apex:pageBlockButtons location="top" >
  <apex:commandButton action="{!NFOSDisplayDivisions}" value="Back" id="next1"/>
  <apex:commandButton action="{!gotoNFOSDIVISION}" value="Add New Competitor" rerender="PB1,PB2"/>
  <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" id="cancel"/>
  </apex:pageBlockButtons>
  <apex:pageBlockTable value="{!selectedDivisions}" var="sb" id="theBlock">
            <apex:column headerValue="Division Name">
            <apex:outputField value="{!sb.Name}"/>
            </apex:column>
            <apex:column headerValue="Availability">
            <apex:inputField value="{!sb.Availability__c}"/>
            </apex:column>
            <apex:column headerValue="Number of Competitors">
           <apex:inputField value="{!sb.Number_of_Competitors__c}"/>
           </apex:column>
           <apex:column headerValue="Active">
           <apex:inputField value="{!sb.Active__c}"/>
           </apex:column>
           </apex:pageBlockTable>    
       </apex:pageBlock>
      
       </apex:form>
</apex:page>

NFOSDIVISION:
<apex:page standardController="Competitor2__c" extensions="NFOSDIVISIONController" lightningStylesheets="true">
               
    <style>
    input[type=text] {
    width: 150px;
    display: block;
    margin-bottom: 10px;
    background-color: white;
    }

   </style>
   
    <apex:sectionHeader title="Noosa Festival of Surfing" />
    <apex:form id="NFOSDIVISION"> 
    <apex:pageBlock title="New Competitor" mode="edit">
        
        <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
            <apex:inputField value="{!acct.Name}" required="false"/>
            <apex:inputField value="{!acct.First_Name__c}" required="true" />
            <apex:inputField value="{!acct.Lastname__c}" required="true" />
            <apex:inputField value="{!acct.Date_of_Birth__c}" required="true" />
            <apex:inputField value="{!acct.Email_Address__c}" required="true" />
            <apex:inputField value="{!acct.Phone_Number__c}" required="false" />
            <apex:inputField value="{!acct.Street_Address__c}" required="true" />
            <apex:inputField value="{!acct.Suburb__c}" required="true" />
            <apex:inputField value="{!acct.Division_Space__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.State__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Postcode__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Country__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!acct.Waiver_Read_T_Cs_Accepted__c}" required="true" />
            <apex:pageBlockSectionItem />
            <apex:commandButton value="Submit" action="{!save}"/>
        </apex:pageBlockSection>
       
        </apex:pageBlock> 
</apex:form> 
</apex:page>