• Resolved wrip

    (@wrip)


    I have my form set up like this:

    [select* topic include_blank "Test1|[email protected]" "Test2|[email protected]" "Test3|[email protected]"]

    [group group_topic_test1 clear_on_hide]
    [select* topic_test1 include_blank "AMG" "PRG" "KGL"]
    [/group]

    [group group_topic_test2 clear_on_hide]
    [select* topic_test2 include_blank "ORG" "COB" "MNM"]
    [/group]

    [group group_topic_test3 clear_on_hide]
    [select* topic_test3 include_blank "IRS" "LOM" "NJH"]
    [/group]

    When the first topic is selected, I get the first group of dropdown displayed and so on. This is all working fine.

    However in the functions.php file, the submitted data $data = $submission->get_posted_data() is not returning the data from the group fields:

    function action_wpcf7_before_send_mail_test( $contact_form ) {
    $form_id = $contact_form->id();

    if ($form_id == "234") {
    $submission = WPCF7_Submission::get_instance();

    if ($submission) {
    $data = $submission->get_posted_data();
    }
    }
    .........
    .........
    .........
    .........
    }

    It returns the selected ‘topic’ but not the group data:

    $data: Array
    (
    [topic_test1] => Array
    (
    [0] =>
    )

    [topic_test2] => Array
    (
    [0] => Test2
    )

    [topic_test3] => Array
    (
    [0] =>
    )
    )

    Am I missing something?

Viewing 1 replies (of 1 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Looks like you have added the clear_on_hide option to the groups, so you will only see the value that you selected in the group that’s visible during form submission, in your test case this seems to be topic_test2

    • This reply was modified 4 months, 4 weeks ago by Jules Colle.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.