You need to sign in to do that
Don't have an account?
Najoua Azaroual
How to submit a form, visualforce page ?
Hi,
I have a visualforce page that contains tabPanel with forms, please i wanna know how to save the records into a custom object ?
here is some lines of the code i'm using :
the code for the controller :
I have a visualforce page that contains tabPanel with forms, please i wanna know how to save the records into a custom object ?
here is some lines of the code i'm using :
<apex:tab label="4- Frais" name="OpenActivities" id="tabOpenAct" disabled="{!currentTab<>'4'}"> <apex:pageBlock > <apex:pageBlockSection > <apex:outputlabel value="{!'Frais (en Dhs) : '}"></apex:outputlabel> <apex:inputtextarea id="frais"/> <apex:outputlabel value="{!'Avance : '}"></apex:outputlabel> <apex:inputtextarea id="avance"/> <apex:commandButton value="Prev" action="{!prevTab}" reRender="AccountTabPanel"/> </apex:pageBlockSection> <apex:commandButton action="{!save}" value="Enregistrer"/> </apex:pageBlock> </apex:tab> </apex:tabPanel> </apex:form> </apex:page>
the code for the controller :
public with sharing class Dossier { public String currentTab { get; set; } { currentTab = '1'; } public void nextTab() { currentTab = String.valueOf(Integer.valueOf(currentTab)+1); } public void prevTab() { currentTab = String.valueOf(Integer.valueOf(currentTab)-1); } public PageReference save() { } }
Which record you want to save ? Please paste your complete vf page .
here's my vf page :
and here's the complete code for the controller :
I am sorry this is too long
Please see the below code
Best Regards
Naga Kiran
this type of task i done,pls see the below code ,its helps to you
visualforce page
<apex:page Controller="TabController" 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="AccountTabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="One" name="name1" id="tabOne">
<apex:pageBlock title="AccoutDetails">
name;<apex:inputField value="{!accfields.name}"/>
<apex:inputField value="{!accfields.phone}"/>
<apex:inputField value="{!accfields.type}"/>
</apex:pageblock>
<apex:pageBlock title="contactdetails">
<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:tab>
</apex:tabPanel>
</apex:form>
</apex:page>
controller
public with sharing class TabController {
public Account accfields{get;set;}
public contact confields{get;set;}
public TabController(){
accfields=new Account();
confields=new Contact();
}
public PageReference saveRecord() {
insert accfields;
insert confields;
return null;
}
}
Naga, the code you gave me works, when i click save, but the inputfield isn't displayed, i can't see it
eswar prasad 15, your code also works, but, i want to make the data i grab in the fields visible when i click save
i want to save and display all the data put in the fields(inputText, picklist..) of all the tabs, by clicking on save