1
0
-1

I would like to have a different credit card image displayed depending on which product the user has selected. Is there a way to dynamically change the image in Maestro and is it possible to dynamically change the size of the image as well if needed?

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Blake, below is an example of a jQuery approach within a blur rule of a text field.

       

      I have added an image component and a text field component (for the URL)

      Secondly, I have added a blur rule to the text field with the following code:

      Util.findElementFromItem will find the element of the item via jQuery.

      Then we need to search for the img element within the item and set the src attribute to the value of the text field.

      You can use this same technique to change other attributes such as the height and width.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        The normal approach is to have several image components with the desired images and dimensions in the form and use visibility rules to display the appropriate one.

        Another approach would be to use jQuery within an action rule (change, click, etc.) to target an image element directly and change its src attribute, and potentially set dimensions.

        The first approach is more idiomatic, but either should work.

        1. Blake Hunter

          Thanks Tim, We are using the URL for the images so the JQuery approach is most likely what I need. Do you have any examples of using JQuery to target the image directgly and change its src and dimension attributes?

        CommentAdd your comment...