Support » Plugin: Contact Form 7 Dynamic Text Extension » Hidden value is visible and outside of form

  • Resolved ccannon8888

    (@ccannon8888)


    Here’s the short code:

    <?php
    function mdcirid_function() {
    global $mdcirid;
    echo $mdcirid;
    }
    add_shortcode(‘form_mdcirid’,’mdcirid_function’);
    ?>

    I tested the short code [form_mdcirid] and it’s working as expected on other pages. The output is a id number set somewhere else – the value, e.g., might be 8881.

    When I add a hidden field via the Contact Form 7 UI like this:

    [dynamichidden mdcirid_value “form_mdcirid”]

    The output I get is this:

    <div class=”panel-grid-cell” id=”pgc-49-2-0″ >8881<div class=”so-panel widget widget_black-studio-tinymce widget_black_studio_tinymce panel-first-child panel-last-child” id=”panel-49-2-0-0″><div class=”textwidget”><p><div role=”form” class=”wpcf7″ id=”wpcf7-f58-p49-o1″ lang=”en-US” dir=”ltr”>
    <div class=”screen-reader-response”></div>
    <form action=”/contact/#wpcf7-f58-p49-o1″ method=”post” class=”wpcf7-form” novalidate=”novalidate”>

    And the rest of the form output continues.

    So, for some reason the output is outside of the form and visible.

    Please let me know how to fix this.

    Thanks…

    https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/

Viewing 1 replies (of 1 total)
  • I found the problem. I was using echo in the function and it needs to be return.

    This works:

    <?php
    function mdcirid_function() {
    global $mdcirid;
    return $mdcirid;
    }
    add_shortcode(‘form_mdcirid’,’mdcirid_function’);
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Hidden value is visible and outside of form’ is closed to new replies.