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
Sascha DeinertSascha Deinert 

Checkbox Infos

Hello,

I have a list with contract numbers which are displayed in a visualforce page, the user could select the numbers which he will need for the analysis. The user should check the checkbox from the contract (multiple choices possible), how can I transport the checked contracts to the nextpage or anlayze?
 
public class Contract_class {

private Id accId {get; set;}

public Contract_class() {
accId = ApexPages.currentPage().getParameters().get('id');

}

public List<Contract__c> getContracts() {
    List<Contract__c> Contracts = [SELECT Name FROM Contract__c WHERE Account_ID_Long__c = :accId];
    RETURN Contracts;
}

public PageReference nextPage () {    
        
    return new PageReference('/apex/Contract_next?id='+accid);   
  
} 

}
<apex:page controller="Contract_class">

<apex:form >

<apex:repeat value="{!Contracts}" var="con">
<apex:inputCheckbox value="{!con.Name}" selected="true" />
<apex:outputField value="{!con.Name}" />
</apex:repeat>

<table>
    <tr>
        <td>
            <apex:commandbutton value="analyze" action="{!nextPage}" />
        </td>
    </tr>
</table>

</apex:form>

</apex:page>
Thanks,
Sascha

 
Raj VakatiRaj Vakati
You need to use wrapper class .. 

1 . On Select update the record id in wrapper class
2 . On click of button pass the selected id to the next page by using URL params 

Refer this link

https://www.forcetalks.com/salesforce-topic/how-to-select-all-checkbox-option-in-salesforce-visualforce-page-without-using-javascript/