Pass images through forms | WordPress.org

[ad_1]

Hello @rui9075918

Thank you very much for using our plugin.

To display a different image based on the choice selected in a radio button or dropdown field, you can use a calculated field as an auxiliary.

I’ll try to describe the process with a hypothetical example.

Assuming you have the radio button field fieldname1 with choices 1, 2, and 3, and you want to display the images: , , and , based on the choice selected:

Insert an “HTML Content” field in the form with the following tag as its content:

<div class="image-container"></div>

Insert a calculated field, that you can hide by ticking a checkbox in its settings, and enter the following equation:

(function(){
var image;
if(fieldname1 == 1) image="https://www.yourwebsite.com/image-a.png";

else if(fieldname1 == 2) image="https://www.yourwebsite.com/image-b.png";

else if(fieldname1 == 3) image="https://www.yourwebsite.com/image-c.png";

jQuery('.image-container').html('<img src="'+image+'">');
})()

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer