You need to sign in to do that
Don't have an account?
Sreeram Chakrapani
If Statement in Visual Force
Hi,
I have a requirement where when a button is clicked, the first thing I need to do is to check the person profile, if it is the correct profile then continue with the processing of displaying the search fields in a visual force page but if it is not the correct profile then redirect the user to another Visual Force Page. I am new to Visual Force and would greatly appreciate if anybody could write a sample code as a starter for the above requirements
Thanks
SC
If you want to do it solely on Visualforce page, you might need to use a little bit of Javascript.
Here is sample code.
If you want to use a controller, then you must write an apex class and in the controller method for the CommandButton you need to verify the User's Profile and based on it you can decide whether to redirect or show the div/output panel
Hope this helps.
Another way to do this without any user intervention is to use the action attribute in Visualforce. More info on the action attribute and the apex:page element can be found here: http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_page.htm
Using the same method from logonkartik's answer, your VF might look like the following: