+ Start a Discussion
Maxi SMaxi S 

How to display record's image based on pick list value selection using visual force pages

I have a picklist in my vf page with below values.
1 bhk
2 bhk
3 bhk

Scenario: If I am selecting 1 bhk from pichlist then all images of 1 bhk should get displayed in my vf page.
(I have a field in my object to check whether flat is 1 bhk/2bhk/3bhk with respective images of flats).

How to develop this scenario vf page?

Hi Maxi S!

In this scenario what you can do is to use the value selected in the picklist as a filtering value while querying the records from the entity/Sobject/table which has the image or link to the image as well as the attribute specifying if the image is for a 1BHK or 2BHK or 3BHK.

For example, the variable you bind for capturing the picklist value on the vfPage is nbOfRooms. While calling the function in the apex class which will ultimately fetch the data for you, you can use it in the query like

List<SobjectNameOfFlatData> listOfFilteredFlats = new List<SobjectNameOfFlatData>();

listOfFilteredFlats = [Select ID, URLofImage__c From SobjectNameOfFlatData Where FlatSize__c =: nbOfRooms LIMIT 50000];

As I am not sure what is your level of competency and what level of details you are looking for in your solution, I just provided a very high level basic example to give you an idea. If you need more details then I can certainly try to be more detailed.

Kind Regards,