• Resolved fedebianchi

    (@fedebianchi)


    Within the form there is a select2 type field that when saved as Post, the value of the Select field is not saved, but only takes the ID of the select without spaces or capital letters.

    Can select2 be disabled?

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

    (@aurovrata)

    when saved as Post, the value of the Select field is not saved, but only takes the ID of the select without spaces or capital letters.

    I am not sure I follow you. Are you saying the the mapped post field only has the select ID attribute and not the actual value that was selected?

    Can select2 be disabled?

    sure, see the select2 documentation.

    I’m using a drop down menu in the CF7 form to select fields to map to title and content of the post–in both cases the entries are being transformed to lower case without spaces: example value might be “Bernards” but it shows up as bernards–or “Delayed Opening” shows up as delayedopening.

    Hi,

    I also have the same problem and after reading the code for a while I think I found the cause:

    in the file “post-my-contact-form-7\public\class-cf7-2-post-public.php” there is the function “array_to_single()” that reduce the array to one single value BUT APPLY ALSO the “sanitize_key()” function to the value of select;

    this function is called by “define_public_hooks()” in the file “post-my-contact-form-7\includes\class-cf7-2-post.php” and for the moment I bypassed it with this code in the “functions.php” of the theme:

    add_filter( 'wpcf7_posted_data_select', 'debug_cf2post_not_sanitize_select', 0, 3 );
    add_filter( 'wpcf7_posted_data_select*', 'debug_cf2post_not_sanitize_select', 0, 3 );
    add_filter( 'wpcf7_posted_data_dynamic-select', 'debug_cf2post_not_sanitize_select', 0, 3 );
    add_filter( 'wpcf7_posted_data_dynamic-select*', 'debug_cf2post_not_sanitize_select', 0, 3 );
    function debug_cf2post_not_sanitize_select( $value, $org, $tag ) {
        if ( is_array( $value ) && isset( $_POST[ $tag->name ] ) && ! is_array( $_POST[ $tag->name ] ) ) {
            $value = $_POST[ $tag->name ];
        }
        return $value;
    }

    ps: I’m using 6.0.5 version of the plugin;

    I hope this help someone;

    Plugin Author Aurovrata Venet

    (@aurovrata)

    well spotted @moikano. Thank you for this insight. I am going to fix this.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    @mainliborg, I just released v6.0.6, can you upgrade and let me know if that solves your issue.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    PS: @moikano, next time you can create a bug report directly in the github repo, or even a PR which I can integrate into the code release.

    thank’s a lot… I confirm that with 6.0.6 the SELECTs work perfectly (for me)!!!

    ps: @aurovrata thank you also for credit!!!

    Plugin Author Aurovrata Venet

    (@aurovrata)

    ps: @aurovrata thank you also for credit!!!

    thank you for the contribution ??

    PS: next time, do a PR on the actual repo, and I will add you as a plugin developer ??

    This fixed the select field issue, but I’m now seeing an issue with the submission properly writing post meta fields. The same mappings which worked previously now aren’t being added at all when the post is made.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    will take a look tomorrow, can you post your form code here so I can test it on my server

    Update: This looks related to my other entry asking about future posting dates. When that’s turned on the meta-data writing breaks. will see if it’s my code causing the issue.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    ok, so I will close this thread as the select field is now fixed, and we can carry on with the other issue in that thread.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘“Select” field saves the data without spaces or capital let’ is closed to new replies.