• Resolved p.beloch

    (@pbeloch)


    Hi,

    hope someone could advice me with a solution.

    I have a custom input select form field SELECTTERM called AKCE [selectterm akce] created in my functions php, poulated with some text options. You can see it in my page form under “Zvolte termín” (choose term).

    This field displays and works well in my form, also the Contact Form DB plugin saves the value correctly. Unfortunatelly is stopped working in Post My CF7 Form plugin. I see no entries AKCE in recently saved posts. I have noticed that there is no longer a connection between post field and form field.

    I tried to remap the field in draft mode – under the “Select a field” I can pick a correct post field, but then under “Select a form field” there is no “AKCE [selectterm]” available. Previously it worked.

    Has something changed?

    Thank you in advance for an advice or a solution.

    Petr Beloch

    The page I need help with: [log in to see the link]

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

    (@aurovrata)

    Hello Petr

    In order to get your custom field tag to reflect on the form mapping field options, it needs to be registered with the CF7 plugin itself and appear in the field tag list above the form editor.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    once you use your field in the form it should appear in the list of available fields to map. If it does not then it is likely that there is a js error on the page which stops the scripts from picking up your field.

    Thread Starter p.beloch

    (@pbeloch)

    Hi,

    thank you for your response. I have replaced deprecated

    wpcf7_add_shortcode('selectterm', 'createbox', true);
    wpcf7_add_shortcode('selectterm*', 'createbox', true);

    with

    add_action( 'wpcf7_init', 'wpcf7_add_shortcode_selectterm' );
    function wpcf7_add_shortcode_selectterm() {
        wpcf7_add_shortcode( array( 'selectterm', 'selectterm*'), 'wpcf7_selectterm_shortcode_handler', true );
    }
    function wpcf7_selectterm_shortcode_handler( $tag )

    Form seems to be working well, but nothing changes in mapping tab.

    Sadly my programming/debuging skills are too weak to do something about that.

    Anyway, thank you for advice.

    Petr B.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Can you try using wpcf7_add_shortcode again and let me know if it works ?

    do you have any errors in your js console?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Also can you confirm that [selectterm] tag appears in the list of fields tags in your form editor?

    Thread Starter p.beloch

    (@pbeloch)

    Hi Aurovrata,

    no, [selectterm] is not present above form edit field. I also created a brand new custom field [cena] (means “price” in Czech), the result is the same.

    Field [cena] is more simple to present my code, here it is:

    add_action( 'wpcf7_init', 'wpcf7_add_shortcode_cena' );
    
    function wpcf7_add_shortcode_cena() {
        wpcf7_add_shortcode( array( 'cena' ), 'wpcf7_cena_shortcode_handler', true );
    }
    
    function wpcf7_cena_shortcode_handler( $tag ) {
    
    	$pole = "<input type=\"hidden\" name=\"cena\" id=\"cena\" value=\"".$GLOBALS['termprice']."\" />";
    	return $pole;
    
    // foo end
    }

    On frontpage the field [cena] is correctly displayed:

    <input type="hidden" name="cena" id="cena" value="4500" />

    I can make an order and SELECTTERM and CENA are present in emails, plugin that captures sent forms also has the values. I even got working google tag manager firing cf7submission event after form submit and I can see correct values in DOM response.

    In DevTools Console there are only 2 errors (blocking google) and 2 warnings about missing google maps stuff.

    Thank you for taking time for this.

    Petr

    • This reply was modified 1 year, 11 months ago by p.beloch.
    • This reply was modified 1 year, 11 months ago by p.beloch.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    no, [selectterm] is not present above form edit field. I also created a field [cena] (means “price” in Czech), behaves the same.

    then this is where the issue is. It is possible that something is wrong with your PHP and CF7 plugin is unable to handle your custom fields any longer.

    This is a CF7 plugin issue. Unfortunately CF7 plugin authors makes many changes that breaks previous versions functionality, so CF7 upgrades need to be tested properly before deploying on a live site.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    PS: If the field does not show in the list of tags on the form editor, how do you create new fields for your custom field?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I can make an order and SELECTTERM and CENA are present in emails, plugin that captures sent forms also has the values. I even got working google tag manager firing cf7submission event after form submit and I can see correct values in DOM response.

    sure, all this will work, but the Post My CF7 Form plugin has been using the tag field list in the editor to correctly identify form fields.

    I will change this to fix the issue. Give me a week and I will come back to you on this.

    Thread Starter p.beloch

    (@pbeloch)

    Thank you very much!

    PS: If the field does not show in the list of tags on the form editor, how do you create new fields for your custom field?

    Easily ?? I created the code, so I know what do I have to write in the form editor. My handler function creates a complete form input including ids, names, classes and values. So I only have to write the basic shortcode [cena] or [selectterm]

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Hello Petr

    v5.5.1 just released with a fix for the tag list. It now get the tag list from the registered tags on the server.

    can you test it and let me know if your fields are not showing up in your mapping dropdowns?

    Thread Starter p.beloch

    (@pbeloch)

    Hello Aurovrata,

    thank you, I will test it on live data within few days and let you know.

    Imediately after update I got this: https://drive.google.com/file/d/1FtwJvsOBygbJAF2otAg3f9xk1W1WPOUL/view?usp=share_link

    But now I cant replicate. Added the connection between form fields and post meta seems to be working.

    More insight: All the post meta fields on the left are ACF. You can access them via ACF specific functions like get_field(‘field_name’), or you can access them via regular WP query. Important is they are stored as regular WP meta fields. As I know by now.

    Thank you!

    Petr

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Immediately after update I got this

    Indeed, this is a functionality to speed up the creation of meta-fields when there are many fields to map. However, this only happens when you have used all the existing post meta fields for mapping form fields and there are still some form fields to be mapped

    Thread Starter p.beloch

    (@pbeloch)

    Hello Aurovrata,

    it really speeds up the process of assigning fields, it’s nice to be able to type the name directly or select from a list.

    This happened just when there was still some post meta left to be mapped. Pairing switched from select field immediately into the text input even when I wanted to use “select” method. This surprised me, that’s why I mentioned it.

    Otherwise, thank you very much for your support, now it works for me like a charm ??

    Petr

    • This reply was modified 1 year, 11 months ago by p.beloch.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    This happened just when there was still some post meta left to be mapped. Pairing switched from select field immediately into the text input even when I wanted to use “select” method. This surprised me, that’s why I mentioned it.

    that’s odd. Are you able to reproduce this error consistently?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Custom created form field to post meta stopped working’ is closed to new replies.