• Resolved chrisdias96

    (@chrisdias96)


    Hi,

    I have a form that takes 2 dropdowns and depending on your choice, will display an estimated size calculator for a machine, containing multiple text fields and and an image that could be one of 3-4 potential images.

    The answer text fields are working using javascript.
    But now sure how can I dynamically change the image according to the choices?

    Thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    The easiest solution would be using dependencies. Insert multiple Media fields with the corresponding images, and then define dependencies in the calculated field to display one of the media fields based on the equation’s results. More information about dependencies by reading the following post in the plugin’s blog:

    https://cff.dwbooster.com/blog/2020/03/01/dependencies

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Thanks for quick response.

    I’m not sure if I can show dependencies because the image to display can only be determined after filling out 2 fields.

    So I define dependencies on one of the calculated field matching the value to the appropriate picture? From here, I can show a value which would be the correct image, but how do I hide the other images?

    • This reply was modified 3 years, 9 months ago by chrisdias96.
    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    All the fields configured as dependent on the same equation are evaluated at once.

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

    Assuming you have a calculated field with the equation fieldname1+fieldname2 and there are three Media fields in the form, fieldname3, fieldname4, and fieldname5. And finally, you want to display the fieldname3 only if the equation’s result is below 10, the fieldname4 field if the equation’s result is equal to 10, and the fieldname5 if the value is greater than 10.

    Configure the first dependency as follows:

    * if the value is “less than” 10, and select the fieldname3 from the list of dependent fields.

    A second dependency as follows:

    * if the value is “equal to” 10, and select the fieldname4 from the list of dependent fields.

    The third dependency:

    * if the value is “greater than” 10, and select the fieldname5 from the list of dependent fields.

    Only one of the images will be visible at once.

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Ok so it works if one of my 2 fields have a dependency.

    I think my issue is I’m comparing the dependency results based off a read only calculated field because the values aren’t updating based off it.

    I have fieldname4 and fieldname5, when chosen displays a read only string answer to fieldname19.(a calculated field)

    fieldname19 has 3 defined dependencies if value is equal to a specific string, it displays either fieldname 22,38 or 39 (my 3 medias).

    When I go to preview, it shows my 3 media images below my calculated field by default, and doesn’t show/hide based on the choices i’m making in fieldname 4 and 5. Am I missing something?

    • This reply was modified 3 years, 9 months ago by chrisdias96.
    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    I’m sorry, but I cannot answer to your question without checking your form in action. Could you send me the link to the page that includes the form, please?

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Images should change depending on field Possible enclosure type 1.

    https://troescorp.com/2819-2/

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    I’ve checked your form. In your dependencies you are comparing with texts. So, you must enclose the values between quotes, as follows:

    if value is equal to 'Indoor Cabinet'

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Thanks,

    The first media is changing, although the 3rd is not appearing, I might be missing on my side.

    Another thing, how do I center the image using the add css layout keywords? I can manually do it but would like the do it quicker with the plugin, I tried center.

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    Please, indicate the values I should select for testing the form, and display the different images.

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    Thanks for your great help so far.

    Please compare 60kwh, 4 hours. Any answer with a ’20 Ft Container’ should have a different image.

    Any answer with a ‘Indoor Cabinet’ is working.

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    In the option where the result contain numbers, like 20 Ft Container you have two alternatives. But the simplest one would be compare with the number only, like:

    if value is equal to 20

    Best regards.

    Thread Starter chrisdias96

    (@chrisdias96)

    I am not sure what you mean, can you specify where I have duplicates values?

    Plugin Author codepeople

    (@codepeople)

    Hello @chrisdias96

    I’ve recommended you to compare with the number only 20 instead of text that contains the number "20 Ft Container"

    Best regards.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Dynamic Image Shown According to Fields’ is closed to new replies.