You need to sign in to do that
Don't have an account?
samruddhi pode
my save button is not working for custom controller... seeking help here.
<apex:page standardController="Employee__c" extensions="Chbox_ShowHide_Controller">
<apex:form >
<apex:pageBlock id="cpBlock" rendered="true" >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Personal Details" id="Block">
<apex:inputField value="{!Employee__c.First_Name__c}"/>
<apex:inputField value="{!Employee__c.Last_Name__c}"/>
<apex:inputField value="{!Employee__c.DOB__c}"/>
<apex:inputField value="{!Employee__c.Email__c}"/>
<apex:inputField value="{!Employee__c.Address__c}"/>
</apex:pageBlockSection>
<apex:outputText value="Employed"/>
<apex:inputCheckbox id="val" value="{!optSelected}" label="Employed">
<apex:actionSupport event="onchange" reRender="cpBlock" action="{!display}"/>
</apex:inputCheckbox>
<apex:outputPanel id="r" rendered="{!optSelected }">
<apex:pageBlockSection title="Employment Details" rendered="{!if(ShowHide==true,true,false)}">
<apex:inputField value="{!Employee__c.Company_Name__c}"/>
<apex:inputField value="{!Employee__c.Company_Address__c}"/>
<apex:inputField value="{!Employee__c.Date_of_Joining__c}"/>
<apex:inputField value="{!Employee__c.Notice_Period__c}"/>
<apex:inputField value="{!Employee__c.Designation__c}"/>
<apex:inputField value="{!Employee__c.Department__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:outputPanel id="re">
{!showHide}
<apex:pageBlockSection title="Skill Sets" rendered="{!if(ShowHide==false,true,false)}">
<apex:inputField value="{!Employee__c.Graduation__c}"/>
<apex:inputField value="{!Employee__c.Post_Graduation__c}"/>
<apex:inputField value="{!Employee__c.University__c}"/>
<apex:inputField value="{!Employee__c.College_Name__c}"/>
<apex:inputField value="{!Employee__c.Programming_Languages__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
after saving record it do not get saved.
<apex:form >
<apex:pageBlock id="cpBlock" rendered="true" >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Personal Details" id="Block">
<apex:inputField value="{!Employee__c.First_Name__c}"/>
<apex:inputField value="{!Employee__c.Last_Name__c}"/>
<apex:inputField value="{!Employee__c.DOB__c}"/>
<apex:inputField value="{!Employee__c.Email__c}"/>
<apex:inputField value="{!Employee__c.Address__c}"/>
</apex:pageBlockSection>
<apex:outputText value="Employed"/>
<apex:inputCheckbox id="val" value="{!optSelected}" label="Employed">
<apex:actionSupport event="onchange" reRender="cpBlock" action="{!display}"/>
</apex:inputCheckbox>
<apex:outputPanel id="r" rendered="{!optSelected }">
<apex:pageBlockSection title="Employment Details" rendered="{!if(ShowHide==true,true,false)}">
<apex:inputField value="{!Employee__c.Company_Name__c}"/>
<apex:inputField value="{!Employee__c.Company_Address__c}"/>
<apex:inputField value="{!Employee__c.Date_of_Joining__c}"/>
<apex:inputField value="{!Employee__c.Notice_Period__c}"/>
<apex:inputField value="{!Employee__c.Designation__c}"/>
<apex:inputField value="{!Employee__c.Department__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:outputPanel id="re">
{!showHide}
<apex:pageBlockSection title="Skill Sets" rendered="{!if(ShowHide==false,true,false)}">
<apex:inputField value="{!Employee__c.Graduation__c}"/>
<apex:inputField value="{!Employee__c.Post_Graduation__c}"/>
<apex:inputField value="{!Employee__c.University__c}"/>
<apex:inputField value="{!Employee__c.College_Name__c}"/>
<apex:inputField value="{!Employee__c.Programming_Languages__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
after saving record it do not get saved.
Could you please share your controller code as well. What kind of problem are you facing to saving the record.
Thanks,
Kapil
(forcecube@gmail.com)
{
public Boolean ShowHide{get;set;}
//del it
public String optSelected {get;set;}
public List<System.SelectOption> ChkValues
{
get{List<SelectOption> resList = new List<SelectOption>();
resList.add(new SelectOption('Option1', 'Personal details'));
resList.add(new SelectOption('Option2', 'Proffessional Details'));
return resList;}
}
public Boolean renderName1
{ get{ return optSelected == 'Option1'; }
}
public Boolean renderName2
{ get{ return optSelected == 'Option1'; }
}
public void display()
{
ShowHide=true;
}
public Chbox_ShowHide_Controller(ApexPages.StandardController controller)
{
}
}
Please find the updated code for page and controller below. Please let me know if this works for you.
Thanks,
Kapil
(Feel free to mail me at: forcecube@gmail.com)
Problem has been solved. Since i am begginner i didnt know about <apex:pagemessages/> tag. I putted <apex:pagemessages/> tag in VF page and then i get to know the error. The error was that the object Employee required fields are not getting inserted. Thats why the records were not saved. So i just gave <apex:inputfield>tag to every required fields.
This successfully running.
[If you got answer from my post please mark it as solution.]
Thanks,
Kapil
(forcecube@gmail.com)