You need to sign in to do that
Don't have an account?
Harsha Shri
Redirect issue in VF Page commandbutton
HI All,
I am having redirect issue in VF page. When I am using reRender and rendered together in commanad button I am getting this issue. If I am not using rerender in command button, It is redirecting to the path what I mentioned in pagereference methond.
This is my code.
Please help me how to resolve this issue.
Thanks in Advance
I am having redirect issue in VF page. When I am using reRender and rendered together in commanad button I am getting this issue. If I am not using rerender in command button, It is redirecting to the path what I mentioned in pagereference methond.
This is my code.
public class SaveRecords{ public PageReference saveToCollege() { Boolean saved = false; saved = Class2.saveCollegeData(WrapperData.result,collegeId); if(saved) { PageReference pg=new PageReference('/'+collegeId ); return pg; } } } <apex:page standardcontroller="College__c" controller="SaveRecords"> <apex:form> <apex:pageBlock id="mySelectedPB1"> some code </apex:pageBlock> <apex:commandButton action="{!saveToCollege}" value="Link to College" rerender="mySelectedPB1" rendered="{!if(WrapperData.result != null,true,false)}"/> </apex:form> </apex:page>
Please help me how to resolve this issue.
Thanks in Advance
Please change the code as per below.
Page:
<apex:commandButton action="{!saveToCollege}" value="Link to College" rerender="mySelectedPB1" rendered="{!shouldIRender}"/>
Class
public boolean getshouldIRender(){
if(WrapperData.result != null)
saved = true;
else
saved = false;
return shouldIRender;
}
For more information please refer the below link
https://salesforce.stackexchange.com/questions/169627/rendering-and-rerendering-a-command-button-after-submitting-a-record
Thanks,
Saroja
Sweet Potato Tec
Hi Saroja,
Thanks you very much for your support
Here my problem is, after command button it is not redirecting to record home page which I mentioned in pagereference method. record is saving but it is not redirecting to the path what I mentioned in pagereference method.
Can you please help me
Regards,
Harsha
public PageReference save() {
PageReference pg=new PageReference('/'+college__c.Id );
return pg;
}
Hope this helps!
Thanks,
Saroja
Thank you very much for your continuious support.
I tried it. but it is not working