URLFOR() Method
URLFOR() method is use to access the url in visualforce page with respect to passed method parameter's.
Here I am going to demonstrate for URLFOR method with some scenario . Some time we have requirement to redirect on page,redirect on action of particular object, perform a action with return url and access a resources.
1. Access css from zipfile resource.
<apex:stylesheet value="{!URLFOR($Resource.Bootstrap,'bootstrap-3.2.0-dist/css/bootstrap.min.css')}"/>
2. Access css file resource.
<apex:stylesheet value="{!URLFOR($Resource.Bootstrap)}"/>
3. Redirect on customPage.
<a href="{!URLFOR($Page.SetUp)}">Accounting Hub</a>
4. Redirect on Action.
<a tabindex="-1" href="{!URLFOR($action.BankAccount__c.New,$ObjectType.BankAccount__c)}">Bank Account</a>.
5. Redirect on page with return url.
<apex:commandButton action="{!URLFOR($Action.Account.view, ID, [retURL=myRet])}" value="New Opportunity" id="theButton"/>
URLFOR() method is use to access the url in visualforce page with respect to passed method parameter's.
Here I am going to demonstrate for URLFOR method with some scenario . Some time we have requirement to redirect on page,redirect on action of particular object, perform a action with return url and access a resources.
1. Access css from zipfile resource.
<apex:stylesheet value="{!URLFOR($Resource.Bootstrap,'bootstrap-3.2.0-dist/css/bootstrap.min.css')}"/>
2. Access css file resource.
<apex:stylesheet value="{!URLFOR($Resource.Bootstrap)}"/>
3. Redirect on customPage.
<a href="{!URLFOR($Page.SetUp)}">Accounting Hub</a>
4. Redirect on Action.
<a tabindex="-1" href="{!URLFOR($action.BankAccount__c.New,$ObjectType.BankAccount__c)}">Bank Account</a>.
5. Redirect on page with return url.
<apex:commandButton action="{!URLFOR($Action.Account.view, ID, [retURL=myRet])}" value="New Opportunity" id="theButton"/>
No comments:
Post a Comment