+ Start a Discussion
vickySFDCvickySFDC 

How to Pass parameters while click image in my page?

Hi All,

I have requirement  clicking image in VF page then it should display list of records .How to pass parameters in clicking on Image in VF and Apex?


Thanks,


vicky
Sonam_SFDCSonam_SFDC
Hi Vicky,

You can create this image as a custom button and then call a function in the controller to doisplay the list of records.

Check the link below to understand how to acheive this:
http://salesforceapexcodecorner.blogspot.in/2011/06/image-as-commandbutton-on-visualforce.html

Ashish_SFDCAshish_SFDC
Hi Vicky, 


You have to use Javascript, 

onclick String The JavaScript invoked if the onclick event occurs--that is, if the user clicks the image.

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_image.htm

And get the parameters that you want. 


Regards,
Ashish
asish1989asish1989
<apex:commandLink action="{!passingParameter}">
                 <apex:image value="{!sLogo}"  width="180" height="60"/>
                    
                         <apex:param value="{!sLogo}" name="First"/>
                    
                 
                  </apex:commandLink >

In the controller you will get parameter 
String param = Apexpages.currentPage().getParameters().get('First');
        System.debug('printing value'+param );