• Resolved oscarmoreta

    (@oscarmoreta)


    Hello

    thanks again for the pluggin, it’s awesome

    I have a question with attributes. I use select2 in several projects, normally I use data-* attributes in selects

    <select class=”select2″ data-disabled-search=”1″ data-sample=”test”></select>

    How can I include data-* attributes in a field based on dynamic dropdown

    thanks

    Oscar

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

    (@aurovrata)

    may I ask what do you use these data attributes for?

    if you use the CF7 dropdown menu tag field, then you ought to put your question on the CF7 plugin support page, as the <select/> html is being created by the CF7 plugin and not this plugin. This plugin just allows you to convert a dropdown menu to a select2 field.

    If you need the data attributes for your select2 instantiation then I suggest you use the js custom options settings.

    If you use use for your own custom scrits, then I suggest you put your data attributes on the parent element of your dropdown menu tag over which you have control.

    If you are using a dynamic_dropdown tag, then you can use the filter hooks provided to add additional attributes to your HTML markup.

    Thread Starter oscarmoreta

    (@oscarmoreta)

    Normally I use the data- * attributes to indicate in each instance of the select their configuration parameters, it’s very useful when in the same form I have several SELECT2 with different configuration options

    with your helper cf7sgCustomHybridddTemplates I don’t need it

    Thanks

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Normally I use the data- * attributes to indicate in each instance of the select their configuration parameters, it’s very useful when in the same form I have several SELECT2 with different configuration options

    agreed that’s a nice way to parametrise an instance. This is what I introduced on the HybridDropdown, the settings are in order of priority:

    1. HTML data-* attributes
    2. options passed in the constructor

    so the cf7sgCustomHybridddTemplates are passed in the constructor (by the plugin) but should you use the php hooks to setup HTML data attributes on the field constructor, then these will override the values set in the js script.

    This has the advantage of programmatically overriding default values you set in your script.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    eres espanol?

    Thread Starter oscarmoreta

    (@oscarmoreta)

    Yes, I am from Barcelona ??

    Plugin Author Aurovrata Venet

    (@aurovrata)

    enhorabuena ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CF7 smart grid – select data-* attributes’ is closed to new replies.