• Resolved deob

    (@deob)


    How do I have a dynamic drop down have a blank line? It is a required field and I don’t want the first value of the field to automatically be entered in the field. I tried using Contact 7 Forms include_blank but it did not work. I don’t see anything in the FAQ.

    Thanks,
    Doreen

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

    (@aurovrata)

    I tried using Contact 7 Forms include_blank but it did not work.

    this works only for CF7 field tags, the dynamic dropdown is a field tag that is part of the Smart Grid plugin.

    The plugin was written with the aim to bring the CF7 plugin back into the WP core framework, ie use the WP way of doing things. It is more efficient and allows other plugins to extend functionality. Therefore to customise the functionality of the plugin (as the default select option in this case), the plugin uses hooks & filters.

    When you create a new dynamic_dropdown field in your Grid UI, you will notice an extra set of filters available as an icon in the column controls of the field (see screenshot #17), I also talk about these field specific filters in this video tutorial. The 4th filter in the list allows you to set the label for the default option (make it blank is you want.), simply click the filter link which will copy a helper code that you can paste in your functions.php file.

    Thread Starter deob

    (@deob)

    I tried putting this (below) in the functions.php but nothing happens. I also have tried using the helper code for only selecting child categories but that totally breaks the site. Am I missing any area of the code that I need to personalize to my form?

    add_filter( ‘cf7sg_dynamic_dropdown_default_value’,’show_category_dynamic_default_option’,10,3);
    /**
    * Filter dynamic dropdown default empty label.
    * @param string $label the label for the default value, this is null by default and not shown.
    * @param string $name the field name being populated.
    * @param string $cf7_key the form unique key.
    * @return string the label for the default value, returning a non-null value with display this as the first option.
    */
    function show_category_dynamic_default_option($default, $name, $cf7_key){
    if(‘2021-entry’!==$cf7_key || ‘show-category’ !== $name){
    return $default;
    }
    $default = ‘Please select an option…’;
    return $default;
    }

    For this field [dynamic_select* show-category class:select2 “slug:portfolio_categories”]

    Plugin Author Aurovrata Venet

    (@aurovrata)

    can you share your page with the form? is it on a public server?

    Thread Starter deob

    (@deob)

    Here it is.

    • This reply was modified 3 years, 8 months ago by deob.
    Thread Starter deob

    (@deob)

    Also, on the same form the data-max for the table isn’t working. I am thinking it may all be part of the same issue.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    so there was indeed an error in the filter attribute list.

    i have fixed this in v4.7.7 just released. Please update and let me know if it works now.

    data-max for the table isn’t working

    not sure what you mean. can you please start a new thread, this makes it easier for other to find similar issues.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    PS: nice form: glad to see you using so many functionality from the Smart grid ??

    are you aware of the Post My CF7 form plugin? It allows you to save form submissions directly to WP posts/custom posts, as well as allowing users to save draft versions of the form before a final submit (this is useful for large forms that take time to fill in). It is fully compatible with the Smart grid.

    Thread Starter deob

    (@deob)

    It works now. Thanks.

    I will have to check out the other plug-in.

    I did create another post for the data-max.

    Enter quilter is different from maker

    Should it not be IF different

    Indeed nice form

    Greetz Alan

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘blank line in dynamic drop down’ is closed to new replies.