fabrik image conditional other field

bonghetti

Member
I'm wondering if it's possible for the image element to change based on the selection of a cascading dropdown (in a form), so that it displays an image based on the chosen option. Is it possible to achieve this with Fabrik?
 
if you have few images and want a quick solution. you could add the various image fields. and then with JavaScript make sure that all image fields are hidden when loading. and then some more JavaScript to show the image based on the menu choice and hide the unnecessary ones
 
You can use a calc element.
Or
if you use a dbjoin element with Ajax update (instead of a CDD) maybe you could use the dbjoin's "Description field" (in Advanced).
 
Done with calc...here is the code, but interesting suggestion with databasejoin

$selected_value = $data['xxx_tab_type___desc_raw'];
if(empty($selected_value)){
$image_url = 'images/postazioni/default.png';
} else {
$image_path = 'images/postazioni/'.$selected_value.'.png';
$image_url = 'https://site.it/site/'.$image_path;
}
$return_value = '<img src="'.$image_url.'" />';
return $return_value;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top