You need to sign in to do that
Don't have an account?
Kumar5
Tab Panel Upsert Method
Hello All,
I am creating Visual force page with tabpanel having two tabs contacts and opportunites. I want to upsert the records using the id with first tab details.
Please help me with upsert method
<apex:page Controller="panelController" showHeader="true">
<apex:form >
<!-- Define Tab panel .css styles -->
<style>
.activeTab {background-color: #236FBD; color:blue; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<!-- Create Tab panel -->
<apex:tabPanel switchType="client" selectedTab="name2" id="ContactTabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="One" name="name1" id="tabOne">
<apex:pageBlock title="ContactDetails">
<apex:inputField value="{!confields.name}"/>
<apex:inputField value="{!confields.phone}"/>
<apex:inputField value="{!confields.type}"/>
<apex:inputField value="{!confields.phone}"/>
<apex:inputField value="{!confields.email}"/>
</apex:pageblock>
<apex:commandButton value="save" action="{!saveRecord}"/>
</apex:tab>
<apex:tab label="Two" name="name2" id="tabTwo">
<apex:pageBlock title="OpportunityDetails">
<apex:inputField value="{!oppfields.name}"/>
<apex:inputField value="{!oppfields.status}"/>
<apex:inputField value="{!oppfields.date}"/>
<apex:pageBlock title="contactdetails">
<apex:inputField value="{!confields.citizenship__c}"/>
<apex:inputField value="{!confields.alliance__c}"/>
</apex:pageblock>
<apex:commandButton value="save" action="{!saveRecord1}"/>
</apex:tab>
</apex:tab>
</apex:tabPanel>
</apex:form>
</apex:page>
Controllerpublic with sharing class panelController {
public Account accfields{get;set;}
public contact confields{get;set;}
public panelController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
insert accfields;
insert confields;
return null;
}
Public PageReference SaveRecord1()
{}
}
Thanks,
Kumar
I am creating Visual force page with tabpanel having two tabs contacts and opportunites. I want to upsert the records using the id with first tab details.
Please help me with upsert method
<apex:page Controller="panelController" showHeader="true">
<apex:form >
<!-- Define Tab panel .css styles -->
<style>
.activeTab {background-color: #236FBD; color:blue; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<!-- Create Tab panel -->
<apex:tabPanel switchType="client" selectedTab="name2" id="ContactTabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="One" name="name1" id="tabOne">
<apex:pageBlock title="ContactDetails">
<apex:inputField value="{!confields.name}"/>
<apex:inputField value="{!confields.phone}"/>
<apex:inputField value="{!confields.type}"/>
<apex:inputField value="{!confields.phone}"/>
<apex:inputField value="{!confields.email}"/>
</apex:pageblock>
<apex:commandButton value="save" action="{!saveRecord}"/>
</apex:tab>
<apex:tab label="Two" name="name2" id="tabTwo">
<apex:pageBlock title="OpportunityDetails">
<apex:inputField value="{!oppfields.name}"/>
<apex:inputField value="{!oppfields.status}"/>
<apex:inputField value="{!oppfields.date}"/>
<apex:pageBlock title="contactdetails">
<apex:inputField value="{!confields.citizenship__c}"/>
<apex:inputField value="{!confields.alliance__c}"/>
</apex:pageblock>
<apex:commandButton value="save" action="{!saveRecord1}"/>
</apex:tab>
</apex:tab>
</apex:tabPanel>
</apex:form>
</apex:page>
Controllerpublic with sharing class panelController {
public Account accfields{get;set;}
public contact confields{get;set;}
public panelController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
insert accfields;
insert confields;
return null;
}
Public PageReference SaveRecord1()
{}
}
Thanks,
Kumar
Please do the following changes in your code : Let me know if it will work for you.
Thanks,
Vishal
If my previous response resolve your issue then mark it as best answer so it will help others in future.
Thanks,
Vishal