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
bhukya nayakbhukya nayak 

Display a list of Contacts with a radio button to select one Contact

hello ,hai to all, i have a task is this,please help, am fresher
Create a 3 step wizard based on Lightning Components using progressIndicator control.

Step 1: Display a list of Contacts with a radio button to select one Contact
Step 2: Show the selected Contact in an edit form (You can hardcode a few fields for this assignment). We may update the field value here. On clicking next, Save the updated Contact
Step 3: Show a confirmation screen with the Update Contact.
Sanket NagpureSanket Nagpure
*****************************Full Answer of This Question *****************************************************************************************

=============================Controller Starts==============================================================

public class ContactRadioSelectionController {
    
    public Id conId{get;set;}
    public Contact contactRecord                                 {get; set;}
    
    public ContactRadioSelectionController(ApexPages.StandardController controller){
        this.conId = ApexPages.currentPage().getparameters().get('id');
        this.contactRecord = (Contact)controller.getRecord();
        System.debug('This Is Updated Record ------->>>>>>>>'+this.contactRecord );
    }
    
    
    public Id contactId {get;set;}
    
    
    
    
    
    public list<Contact> conList{get;set;}
    
    List<Contact> contacts =[SELECT Id,Salutation,FirstName,LastName,Status__c FROM Contact limit 10];
    
    public List<Contact> getContacts(){
        return contacts;
    }
    
    public PageReference getToEdit(){
        
        //  PageReference RedirectingLink = 'https://eidebailly--bn--c.visualforce.com/apex/contactradioselectionpage?core.apexpages.request.devconsole=1';   
        Set<Id> contactSet =new Set<Id>();
        
        System.debug('Cont Id'+conId);
        
        if(conId != null)
            conList = [SELECT  Id,
                       FirstName,
                       LastName,
                       MobilePhone 
                       From Contact
                       WHERE Id = :conId];
        for(Contact con :conList){
            contactSet.add(con.Id);
        }
        
        System.debug('ConList -->>>.>>'+conList);
        System.debug('Con List Of Set  Id-->>>.>>'+contactSet);
        //https://eidebailly--bn.lightning.force.com/lightning/r/Contact/'+conId+'/view'
        //https://eidebailly--bn--c.visualforce.com/apex/ContactRadioSelectionPage?id='+
        PageReference pr = new PageReference('https://eidebailly--bn--c.visualforce.com/apex/ContactRadioRedirectedUpdatePage?id='+conId);
        pr.setRedirect(true);
        return pr;
        
        
    }
    
    public PageReference saveContact(){
        try{
            System.debug('Contact Record--->>>>>>>>'+contactRecord);
            upsert contactRecord;
        }catch(Exception ex){
            system.debug('Exception occurs in saveing'+ex);   
        }
        PageReference pageRef=new PageReference('https://eidebailly--bn--c.visualforce.com/apex/ContactRadioSelectionPage?core.apexpages.request.devconsole=1');
        return pageRef;
    }
    
}


=============================Controller Ends==============================================================

=============================VF Page One  Starts==============================================================


<apex:page standardController="Contact" extensions="ContactRadioSelectionController"   showHeader="true" sidebar="true">
    
    <apex:outputpanel >
        <apex:actionstatus id="counterStatus">
            <apex:facet name="start">
                <div class="waitingSearchDiv" id="el_loading" style="background-color: #DCD6D6; height: 100%;opacity:0.65;width:100%;">
                    <div class="waitingHolder" style="top: 74.2px; width: 91px;">
                        <img class="waitingImage" src="/img/loading.gif"     title="Please Wait..." />
                        <span class="waitingDescription">Redirecting.....</span>
                    </div>
                </div>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputpanel>
    
    
    <apex:pageBlock id="conRerender">
        
        <apex:form id="myForm">
            <apex:pageBlockTable value="{!contacts}" var="cont">
                <apex:column headerValue="Id" value="{!cont.Id}"/>
                <apex:column headerValue="First Name" value="{!cont.FirstName}"/>
                <apex:column headerValue="Last Name" value="{!cont.LastName}"/>
                <apex:column headerValue="Select"> 
                    <input type="radio" name="<strong>selectRadio</strong>">
                    <apex:actionSupport event="onclick" action="{!getToEdit}" reRender="conRerender" status="counterStatus" >
                        <apex:param assignTo="{!conId}" id="contId" name="contId" value="{!cont.Id}"/>
                    </apex:actionSupport>   
                </input>  
            </apex:column>

        </apex:pageBlockTable>
    </apex:form>
    
    <apex:pageBlockButtons >
        <apex:form >
            <apex:commandButton value="Go to edit Page" action="{!getToEdit}"/>
        </apex:form>
    </apex:pageBlockButtons>
</apex:pageBlock>

</apex:page>

=============================VF Page One  Ends==============================================================


=============================VF Page Two  Starts==============================================================

<apex:page standardcontroller="Contact" extensions="ContactRadioSelectionController" >
    
    <apex:outputpanel >
        <apex:actionstatus id="actStatusId">
            <apex:facet name="start">
                <div class="waitingSearchDiv" id="el_loading" style="background-color: #DCD6D6; height: 100%;opacity:0.65;width:100%;">
                    <div class="waitingHolder" style="top: 74.2px; width: 91px;">
                        <img class="waitingImage" src="/img/loading.gif"     title="Please Wait..." />
                        <span class="waitingDescription">Saving...</span>
                    </div>
                </div>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputpanel>
    
    <apex:pageBlock id="pgBlckId" >
        <apex:form id="formId">
            <apex:pageBlockSection title="Current account record Id is : {!conId}" collapsible="false">
                <apex:pageBlockTable value="{!Contact}" var="conn">
                    <apex:column headerValue="First Name">
                        <apex:inputField value="{!conn.FirstName}" required="true"/>
                    </apex:column>
                    <apex:column headerValue="Last Name">
                        <apex:inputField value="{!conn.LastName}" required="true"/>
                    </apex:column>
                </apex:pageBlockTable>
                
            </apex:pageBlockSection>
            
            <apex:commandButton value="Save" action="{!saveContact}" reRender="pgBlckId" status="actStatusId" />
            
            
            
            <apex:pageBlockSection title="Testing parameter" collapsible="false">
                Name is <b>{!conId}</b>
            </apex:pageBlockSection>
        </apex:form>   
    </apex:pageBlock>
</apex:page>

=============================VF Page Two  Ends==============================================================





Note :- *Kindly please mark if Solution make you Satisfied