PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Images in dropdowns

  1. My client would like the dropdowns to include an image - in her case, to choose colour, material, buckle design etc.

    I see GravityForms uses jQuery, and someone's achieved it here, so something for GravityForms to implement too?

    http://www.marghoobsuleman.com/jquery-image-dropdown

    thanks,

    Colin

    Posted 13 years ago on Thursday April 28, 2011 | Permalink
  2. Hi Colin,

    This is possible to implement with Gravity Forms. You would just need to download and install the script then using jQuery, initialize the script for the drop downs you would like to target. Something like this:

    [js]
    $("select#input_1_2").msDropDown();
    Posted 13 years ago on Thursday April 28, 2011 | Permalink
  3. David is currently traveling but i've forwarded this to him via email so when he gets a chance he will post a follow up response on this.

    Posted 12 years ago on Friday July 1, 2011 | Permalink
  4. thanks, i post another question about another inquiry regarding custom post types content

    http://www.gravityhelp.com/forums/topic/dynamically-populate-checkboxes-based-on-post-names

    Posted 12 years ago on Friday July 1, 2011 | Permalink
  5. Could you do a tutorial on this ?? I would love to see how to have images show on a dropdown .. I'm not clear on the answer above ...

    Posted 12 years ago on Friday September 2, 2011 | Permalink
  6. sylvain@logographe.ca
    Member

    To implement this function, we have to edit the title attribute for each option.
    Can we do that with your plugin?

    Posted 12 years ago on Friday January 6, 2012 | Permalink
  7. You can add the attribute via jQuery as well, something like this:

    <script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery("#inputID option[value='Field Value']").attr('title', 'Testing');
    });
    </script>

    Use the ID on the select and then list the value in the option and then add your title value (img src) and rinse and repeat.

    Posted 12 years ago on Saturday January 7, 2012 | Permalink
  8. sylvain@logographe.ca
    Member

    Thanks, it worked!
    I suppose we can also transpose all the "values" as "titles" automatically... ?

    Posted 12 years ago on Saturday January 7, 2012 | Permalink
  9. sylvain@logographe.ca
    Member

    Found the solution:
    - created a folder in my theme for images
    - the value attribute set in Gravity become the name of the png in that folder

    The code:

    var templateDir = "<?php bloginfo('template_directory') ?>";
    jQuery(document).ready(function(){
        jQuery(".msdropdown option").attr('title', function() {
    	var file = this.value + '.png';
    	var path = templateDir+'/options/';
    	return path+file});
    
    });
    Posted 12 years ago on Saturday January 7, 2012 | Permalink
  10. Awesome, glad you got it working!

    Posted 12 years ago on Saturday January 7, 2012 | Permalink