function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Developer_shaanDeveloper_shaan 

show hide images

I have an requirement-

 

i have two images which should be invisible by default .

When a button is clicked ,  first button should be visible and second should be in invisible mode.

And when clicked again the second button should be visible.

 

Can we make images invisible by default in VF.

Can anyone help me with soln.

 

Thanks in advance.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
gautamgautam

use rendered parameter..in this example i have use it to show diff images to diff profile when they log in ...

 

<apex:page >
<b> Hello !!</b>
<p> You have logged in as {!$User.FirstName} {!$User.LastName}</p> <br/><br/>
<p> Your profile is {!$Profile.Name}..</p><br/><br/>
<apex:image url="{!$Resource.hpepp}" rendered="{!$Profile.Name='custportaluser'}" />
<apex:image url="{!$Resource.hp}" rendered="{!$Profile.Name='Customer Portal Manager'}"/>
</apex:page>

All Answers

gautamgautam

use rendered parameter..in this example i have use it to show diff images to diff profile when they log in ...

 

<apex:page >
<b> Hello !!</b>
<p> You have logged in as {!$User.FirstName} {!$User.LastName}</p> <br/><br/>
<p> Your profile is {!$Profile.Name}..</p><br/><br/>
<apex:image url="{!$Resource.hpepp}" rendered="{!$Profile.Name='custportaluser'}" />
<apex:image url="{!$Resource.hp}" rendered="{!$Profile.Name='Customer Portal Manager'}"/>
</apex:page>
This was selected as the best answer
Developer_shaanDeveloper_shaan

Hey thanks a lot for the quick reply.

Thats awesome i was trying it out to figure out using javascript.

This is the exact soln.

 

Thanks again.

cheers!

 

 

Developer_shaanDeveloper_shaan

 

Here we can check only one condition . that is image is dispalyed when Profile name is custportaluser what about if i need to heck other condution user name = shaan.

can we use rendered parameter to check two conditions.

 

ex:

<apex:page >
<b> Hello !!</b>
<p> You have logged in as {!$User.FirstName} {!$User.LastName}</p> <br/><br/>
<p> Your profile is {!$Profile.Name}..</p><br/><br/>
<apex:image url="{!$Resource.hpepp}" rendered="{!$Profile.Name='custportaluser'} ,
{!$user.Name='shaan'}

" />
<apex:image url="{!$Resource.hp}" rendered="{!$Profile.Name='Customer Portal Manager'}"/>
</apex:page>