+ Start a Discussion
TechnosTechnos 

Open the visual force page on the click of Edit button of list view

Hi all,

 

As I am new with SalesForce, I have implemented a VF page on that page I am doing lots of stuff like load of data in second object on the slection of first one , Creation of pick list, load of Pageblock on certain condition like that.  After all this I am able to save the records as my requirment. Now I want to edit that object, in which I saved this record, I know that we can do by the SalesForce Standard page but I want to edit by my VF page. So how to do that means  Just suppose the object which I want to edit is Acessioning, If I give the ID of particular accesioning in url by query string or click on edit button which we have on standard salesforce list view than my VF page should be open with all the loade fields of that object. and I would be able to update the records.

 

Please suggest any article or anything which can help me to do this.

 

MY VF page code is this

 

<apex:page Controller="ExtentionController"  >
    <apex:form >
    <apex:actionFunction name="validatedAction" action="{!SearchPatient}" />
        <apex:pageblock title="Accessioning" >
       
          <apex:pageBlockSection >
                <apex:selectList required="true" multiselect="false" size="1" label="Labs" value="{!LabSelectedvalue }"  style="align:left">
                <apex:selectOptions value="{!LabOption}"/>
          </apex:selectList>
           <apex:selectList required="true" multiselect="false" size="1" label="Clients"  style="align:left" value="{!ClientselectedValue}" >
                      <apex:selectOption itemvalue="" itemLabel="--None--" />
                      <apex:selectOptions value="{!Clientoption}"/>
                      <apex:actionSupport event="onchange" action="{!GetPhysicianNameByClient}"  reRender="detailsPhysician"/>
                 </apex:selectList> 
            </apex:pageBlockSection>
            <apex:pageBlockSection id="detailsPhysician" >
                  <apex:selectList multiselect="false" size="1" label="Facility"  style="align:left" value="{!Facilityselectedvalue}">
                     <apex:selectOption itemvalue="" itemLabel="--None--" />
                     <apex:selectOptions value="{!FacilityOption}" />
                 </apex:selectList>
                 <apex:selectList multiselect="false" size="1" label="Physician"  style="align:left" value="{!Physicianselectedvalue}">
                     <apex:selectOption itemvalue="" itemLabel="--None--" />
                     <apex:selectOptions value="{!PhysicianOption}" />
                 </apex:selectList> 
            </apex:pageBlockSection>
           
             <apex:pageBlockSection >
                 <apex:inputField value="{!objAccession.RequisitionNo__c}"/>
             </apex:pageBlockSection>
             <div style= "width: 40%; float: left;">
              <table cellspacing="20px" align="center">
              <tr>
             <td>
                 <label style="color:#4A4A56"> Search Patient </label>
             </td>
             <td>
              <apex:inputtext value="{!SearchPatient}" id="txtSearchPatient" /> </td>
                 <td>
                 <apex:commandButton value="Search"   reRender="thePanel" onclick="abcd('{!$Component.txtSearchPatient}')" /></td>
                 </tr>
                 </table>
                 </div>
             <div style= "float: right; width: 40%;">
             <apex:outputPanel id="thePanel">
              <apex:pageBlockSection id="pageBlockProcessed" rendered="{!Rendered}">
                  <apex:dataTable id="dtPatientRecords"  value="{!objPatientList}" var="pt"  cellspacing="16%" >
              
                   <apex:column headerValue="FirstName">
                   <apex:commandLink action="{!PopulateFields}" value="{!pt.FirstName__c}"  >
                   <apex:param name="PatientID" assignTo="{!PatientID}" value="{!pt.id}"/>
                    <apex:param name="testFirstName" assignTo="{!objPatient.FirstName__c}" value="{!pt.FirstName__c}" /> 
                   <apex:param name="testMiddleName" assignTo="{!objPatient.MiddleName__c}" value="{!pt.MiddleName__c}"/>
                   <apex:param name="testLastName" assignTo="{!objPatient.LastName__c}" value="{!pt.LastName__c}"/>
                   <apex:param name="testAddress" assignTo="{!objPatient.Address__c}" value="{!pt.Address__c}"/>
                   <apex:param name="testCountry" assignTo="{!objPatient.Country__c}" value="{!pt.Country__c}"/>
                   <apex:param name="testState" assignTo="{!objPatient.State__c}" value="{!pt.State__c}"/>
                   <apex:param name="testCity" assignTo="{!objPatient.City__c}" value="{!pt.City__c}"/>
                   <apex:param name="testGender" assignTo="{!objPatient.Gender__c}" value="{!pt.Gender__c}"/>
                   </apex:commandLink>
                   </apex:column>
                   <apex:column headerValue="Middle Name" >
                   <apex:outputField value="{!pt.MiddleName__c}" />
                   </apex:column>
                   <apex:column headerValue="Last Name" >
                   <apex:outputField value="{!pt.LastName__c}" />
                   </apex:column>
                  </apex:dataTable>  
             </apex:pageBlockSection>
             </apex:outputPanel>
             </div>
             <div style = "clear:both;"></div>
                <apex:pageBlockSection title="Patient">
                    <apex:inputField value="{!objPatient.FirstName__c}" />
                  <apex:inputField value="{!objPatient.MiddleName__c}" />
                  <apex:inputField value="{!objPatient.LastName__c}" />
                 <apex:inputField value="{!objPatient.Address__c}"/>
                 <apex:inputField value="{!objPatient.Country__c}"/>
                 <apex:inputField value="{!objPatient.State__c}"/>
                 <apex:inputField value="{!objPatient.City__c}"/>
                 <apex:inputField value="{!objPatient.Gender__c}"/>
                 <apex:inputField value="{!objPatient.DOB__c}"/>
                 <apex:inputHidden value="{!PatientID}"/>
                </apex:pageBlockSection>
             <apex:pageBlockSection title="Case Information" >
                <apex:selectList required="true" multiselect="false" size="1" label="Case(s)"  value="{!selectedValue}"  >
       <apex:actionSupport event="onchange" action="{!GenerateCaseNumber}" reRender="detail"/>
       <apex:selectOptions value="{!CaseTypeOption }"/>
       </apex:selectList>
       <div>
             <apex:outputPanel id="detail"  >
             <apex:outputLabel value="{!TestFinalCaseNumber}"></apex:outputLabel>
           &nbsp;&nbsp;&nbsp;
              <apex:commandButton Value="Add Specimen"   reRender="detail1"  rendered="{!IF(TestFinalCaseNumber !=null  &&  TestFinalCaseNumber!='',true,false)}">
             </Apex:commandButton>
             </apex:outputPanel>
       </div>
             <!--<apex:commandButton Value="Add Specimen"  action="{!AddSpecimen}" reRender="detail1" >
             </Apex:commandButton>-->
             <apex:outputPanel id="detail1">
            <apex:pageBlockSection id="pageBlockProcessed" rendered="{!RenderedSpecimen}">
            <!-- <apex:dataTable id="calldataTable" value="{!objSpecimen}" var="spec" cellspacing="16%">
             <apex:column headerValue="Tissue Type">
             <apex:selectList multiselect="false" size="1" >
              <apex:selectOptions value="{!TissueTypeOption }"/>
               </apex:selectList>
               </apex:Column>
               <apex:column headerValue="Description">
               <apex:outputLabel value="{!spec.Description__c}"></apex:outputLabel>
               </apex:Column>
             </apex:dataTable> -->
              <style type="text/css">
              .dateFormat{float:left; display:inline-block; clear:both}
              th{white-space: normal;}
              </style>
             
              <table cellspacing="0">
              <tr>
                 <th style="text-align:center"> Tissue Type </th>
               <th style="text-align:center"> Specimen Site</th>
               <th style="text-align:center"> Transport Container/ Medium</th>
              <th style="text-align:center">  Pieces Received </th>
              <th style="text-align:center">  Specimen Description/ Procedure </th>
              <th style="text-align:Center">  Collection Date</th>
              <th style="text-align:center">  Recieved Date</th>
              <th style="text-align:center">  Request Date</th>
              <th style="text-align:center">  Test </th>
               </tr>
               <tr>
                <td>
                 <table>
                 <tbody>            
              <apex:selectList multiselect="false" size="1" value="{!SelectedTissueType}"  >
              <apex:selectOptions value="{!TissueTypeOption }"/>
               </apex:selectList>
               </tbody>
              </table>
             
</td>           
<td>
                 <table> 
                 <tbody> 
              <apex:selectList multiselect="false" size="1"  value="{!SelectedSpecimenSite}" >
              <apex:selectOptions value="{!SpecimenSiteOption }"/>
               </apex:selectList>
               </tbody>
               </table>
             
</td>  
 <td>
                 <table>
                 <tbody>            
              <apex:selectList multiselect="false" size="1" value="{!SelectedTransportType}"  >
              <apex:selectOptions value="{!TransportTypeOption }"/>
               </apex:selectList>
               </tbody>
              </table>
             
</td>         
<td>
            <table>
            <tbody>
            <apex:inputText id="txtPiecesRecieved" value="{!SpecimenPiecesRecieved}" />
            </tbody>
            </table>
</td>           
  <td>
            <table>
            <tbody>
            <apex:inputTextarea id="txtSpecimenDescription" value="{!SpecimenDescription}" />
           
            </tbody>
            </table>
</td>
<td>
            <table>
            <tbody>
            <apex:pageBlockSectionItem >
            <apex:inputField value="{!objSpecimen.CollectedDate__c}"/>
            </apex:pageBlockSectionItem>
           
            </tbody>
            </table>
</td> 
<td>
            <table>
            <tbody>
              <apex:pageBlockSectionItem >
            <apex:inputField value="{!objSpecimen.ReceivedDate__c}"/>
            </apex:pageBlockSectionItem>
            </tbody>
            </table>
</td>
 <td>
            <table>
            <tbody>
              <apex:pageBlockSectionItem >
            <apex:inputField value="{!objSpecimen.RequestDate__c}"/>
            </apex:pageBlockSectionItem>
            </tbody>
            </table>
</td>
<td>
                 <table>
                 <tbody>            
              <apex:selectList multiselect="false" size="1" value="{!seletedTestValue}"  >
              <apex:selectOptions value="{!LoadTests }"/>
               </apex:selectList>
               </tbody>
              </table>
             
</td> 
               </tr>
              </table>
             
               </apex:pageBlockSection>
             </apex:outputPanel>
             </apex:pageBlockSection>
            
             
            <apex:pageBlockSection title="Comments" >
                   <apex:inputField value="{!objComment.Comment__c}" style="width:75%"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                  <apex:commandButton action="{!save}" value="Done"/>
            </apex:pageBlockButtons>
        </apex:pageblock>
  </apex:form>
  <script type="text/javascript">
   function abcd(id)
     {
       var temp=document.getElementById(id).value;
       if(temp==null||temp=='')
       {
         alert("Please enter any of the Patient Information");
         return false;
        }
        else
        {
            validatedAction();
        }
     }

</script>
</apex:page>

 

Regards

Raman

sambasamba

If you can provider a test account. It's very good. Thanks.

 

 

Thanks,

Samba

TechnosTechnos

Can you please tell me in detail what you  are asking for ????

 

Regards

Raman