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
Sfdc_beginnerSfdc_beginner 

Is it possible to create a custom VF form with tabs ?

Hi There,

 

I am new to Salesforce, Kindly let me know if we can create a custom Visualforce form page with tabs (as section) and how to create the corresponding custom controller to update 2 custom object. Also, please share an example.

 

Thanks

asish1989asish1989

HI

If you want to design multiple tab in a visual force page then use <apex:tabpanel> and <apex:tab>.

for reference you can go through this link

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_tab.htm

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_tabPanel.htm

 Also you can make visualforce page as tabs. Setup-->create--->tabs--->vf tabs.

 

Now you want to update two different object records .

<apex:page controller = "customcontroller">
   <apex:form>
     <apex:pageBlock>
       <apex:pageBlockSection>
          <apex:inputField value="{!account.Name}"/>
          <apex:inputField value = "{!contact.LastName}"/>
          <apex:commandbutton value="save" action =" {!saving}"/>
       <apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>  
</apex:page> 

Controller-----
public class customcontroller{
 public Account account{get;set;}
 public Contact contact{get;set;}
 // get id both object

public customcontroller(){
   account = new Account(id = someid which you have alreagy got as parameter);
contact= new Contact(id = someid which you have alreagy got as parameter);


}
public PageReference saving{
  upsert account;upsert contact;
return null
}
}
 

 Did  this post answers your question if so please give kudos and mark it as solution

 

Thanks