Forum Replies Created

  • Jay

    Member
    May 31, 2018 at 5:23 am in reply to: Editing a record from selecting list of record using radio button

    Hi Aman,

    main concern is below line is calling the action method edit i.e. goToEdit

    after selection of radio button

    <apex:actionSupport event=onclick”  action="{!goToEdit}">

     

    and I am not using any sObject layout, I am taking Id from VF page in controller action method and fetching that particular record for edit operation.

  • Jay

    Member
    May 29, 2018 at 1:44 pm in reply to: Editing a record from selecting list of record using radio button

    Hi Aman

    VF and Controller code is mentioned below

    <apex:page Controller="ContactCustomController" >
    <apex:pageBlock title="contact List">
    <apex:form >
    <apex:pageBlockTable value="{!contacts}" var="con">
    <apex:column headerValue=" Name" value="{!con.Name}"/>

    <apex:column headerValue="Select">
    <input type="radio" name="selectRadio" id="radio">
    <apex:actionSupport event="onclick" action="{!goToEdit}" ><br/> <apex:param name="id" value="{!con.id}"/>
    </apex:actionSupport>
    </input>

    </apex:column>
    </apex:pageBlockTable>
    </apex:form>

    <apex:pageBlockButtons >
    <apex:form >
    <apex:commandButton value=" Go to edit page" action="{!goToEdit}"/>
    </apex:form>
    </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:page>

    Controller:

    public class ContactCustomController {
    Id Idvalue;
    Contact con;
    List<Contact> contacts=[SELECT Name, Id FROM contact];
    List<account> accs=[SELECT Name FROM Account ];
    List<Hospital__c> hosps=[SELECT Name FROM Hospital__c ];

    public List<Contact> getContacts(){
    return contacts;
    }
    public List<Account> getaccs(){
    return accs;
    }
    public List<Hospital__c> gethosps(){
    return hosps;
    }
    public PageReference goToEdit(){
    System.debug('Inside go to edit');
    Idvalue = ApexPages.currentPage().getParameters().get('id');
    system.debug('Id value='+Idvalue);
    con=[SELECT Name, MobilePhone, Id FROM contact WHERE Id=:Idvalue];
    return Page.ContactEditPage;
    }

    }

    • This reply was modified 6 years, 5 months ago by  Jay.

Popular Salesforce Blogs

Popular Salesforce Videos