• Resolved wkdel

    (@wkdel)


    Hi,

    We are looking to have an option where the user can select an image to show the type of product they wish to enquire about. Is there a way to do this using dynamic dropdown etc.?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    that’s an interesting question. the dynamic dropdown field has been designed to be quite flexible, but before I give you pointers I need to understand a little more what you’re trying to do.

    the dynamic dropdown by default populates a select field’s option from either of the following source list,

    • taxoonomy terms – it uses the terms as dropdown options.
    • post tilles – it uses post slugs as option value and titles as labels
    • custom filter – it expects an array of option $value=>$label pairs.

    If I understand you have a set of products as custom posts with thumbnail images you want to display?

    Are you looking at making a select2 dropdown field with images in options?

    Thread Starter wkdel

    (@wkdel)

    Thanks for the reply. The idea is for people to be able to highlight a specific style of product by selecting from a range in the form. After seeing the dynamic dropdown option I thought that could be a good choice. However after trying it I could only get text to appear rather than actual images.

    The select2 dropdown field with images that you show could be a option. Looks like it shows images within the dropdown. Is this something that can be implemented using the smart grid plugin?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I understand. so the way to create a custom select2 is to create a dynamic dropdown on your form with your choice of posts as source, and the select2 field checked.

    The plugin gives you control on the way your posts are queried using the ‘cf7sg_dynamic_dropdown_post_query’.
    When the plugin builds the options of the dropdown, it uses the posts slug as unique value, and the post title as the label, which you can filter with ‘cf7sg_dynamic_dropdown_option_label’. You can further add attributes (such as class and data custom attributes for each option using the filer ‘cf7sg_dynamic_dropdown_option_attributes’.

    v2.0 introduces inline helpers for field specific hooks in the grid UI editor. See screenshot #18 for an example. click the links to copy the helper and paste it in your functions.php file. The helper includes details of the parameters passed to the filter and how to use it.

    when your form loads you want to create a custom js script file for your form (see FAQ #8), and wait till the plugin has loaded/enabled your form, it will trigger a cf7SmartGridReady event on the form element itself. You can then customise your select2 field using the template theming option offered by select2.

    hope this is all clear. If you need more hand-holding, please read this post.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘image selection in form’ is closed to new replies.