You need to sign in to do that
Don't have an account?
Preethi S
how to hide all labels and fields after clicking save button in visualforce page
i dont know where should i give rendered attribute to hide fields.. could u help for this?
VF page:
<apex:page controller="SuccessController1" showheader="false">
<apex:form id="file1">
<apex:pageMessages id="msg"/>
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!cand.FirstName__c}"/>
<apex:inputField value="{!cand.LastName__c}" />
<apex:inputField value="{!cand.SSN__c}" />
<apex:inputField value="{!cand.city__c}" />
<apex:inputField value="{!cand.Phone__c}" />
<apex:inputField value="{!cand.Email__c}" />
<apex:commandButton action="{!save}" value="save"/>
<apex:outputPanel id="file1" rendered="{!hidefn}">
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:
public with sharing class SuccessController1 {
public boolean hidefn { get; set; }
public SuccessController1() {
hidefn=false;
}
Candidate__c cand = new Candidate__c();
Public Candidate__c getCand()
{
return Cand;
}
public SuccessController1(ApexPages.StandardController controller)
{
}
public PageReference save()
{
insert cand;
PageReference p = apexPages.currentPage();
ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!');
ApexPages.addMessage(msg);
return p;
}
}
But I don't know where we have to use that "rendered "attribute in vf page...after clicking save button i want to show success message with blank page...
If i use that rendered attribute in input field.....that field will be hided before giving input...Anyone can help for this..
VF page:
<apex:page controller="SuccessController1" showheader="false">
<apex:form id="file1">
<apex:pageMessages id="msg"/>
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!cand.FirstName__c}"/>
<apex:inputField value="{!cand.LastName__c}" />
<apex:inputField value="{!cand.SSN__c}" />
<apex:inputField value="{!cand.city__c}" />
<apex:inputField value="{!cand.Phone__c}" />
<apex:inputField value="{!cand.Email__c}" />
<apex:commandButton action="{!save}" value="save"/>
<apex:outputPanel id="file1" rendered="{!hidefn}">
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:
public with sharing class SuccessController1 {
public boolean hidefn { get; set; }
public SuccessController1() {
hidefn=false;
}
Candidate__c cand = new Candidate__c();
Public Candidate__c getCand()
{
return Cand;
}
public SuccessController1(ApexPages.StandardController controller)
{
}
public PageReference save()
{
insert cand;
PageReference p = apexPages.currentPage();
ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!');
ApexPages.addMessage(msg);
return p;
}
}
But I don't know where we have to use that "rendered "attribute in vf page...after clicking save button i want to show success message with blank page...
If i use that rendered attribute in input field.....that field will be hided before giving input...Anyone can help for this..
Change ur page , controller like below.
All Answers
Change ur page , controller like below.
you should use "rendered" attribute in "pageBlockSection" or "pageBlock" and create a boolean type of variable which is initialize with "True" in Controller's constructor.
And then in Save method set this variable with false.
so after saving the record all inputFields are hide and only your Success message is shown on page.
i hope this will help you
Regards
Viru