I have one VF page that contains custom fields: VF Page : DEMO
<apex:page standardController="Order__c" extensions="MyOrderPadController" >
<apex:detail />
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!edit}" value="Edit"/>
<apex:commandButton action="{!reset}" value="Cancel" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" title="Order Pad">
<apex:inputField value="{!Order__c.Order_Description__c}" />
<apex:inputField value="{!Order__c.Creat_Date__c}" />
<apex:inputField value="{!Order__c.Closed_Date__c}" />
<apex:inputField value="{!Order__c.Conformation__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller :MyOrderPadController
public class MyOrderPadController {
public Order__c order{ get; private set;}
public MyOrderPadController (){}
public MyOrderPadController(ApexPages.StandardController sc) {
order = (Order__c)sc.getRecord();
order.Account__c = ApexPages.currentPage().getParameters().get('aid');
}
public PageReference edit()
{
return null;
}
public PageReference reset()
{
PageReference newpage = new PageReference(System.currentPageReference().getURL());
newpage.setRedirect(true);
return newpage;
}
public PageReference save()
{
TRY
{
order.Name = 'Demo ';
IF(order.Conformation__c == TRUE){
INSERT order;
PageReference newpage = new PageReference(System.currentPageReference().getURL());
newpage.setRedirect(true);
return newpage;
}
}
catch(System.DMLException e)
{
ApexPages.addMessages(e);
SYSTEM.DEBUG('ERROR ORDER PAD CONTROLLER :'+e);
return null;
}
// After Save, navigate to the default view page:
//return (new ApexPages.StandardController(order)).view();
return null;
}
}
My question is after click the save button all fields in the VF page not editable (read only),future edit possible,User where ever click the conformation checked then at the time only record is insert in the "Order__c",user unchecked conformation then click the save button save the VF page read only.Please some one help me.