WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 » Need help populating custom input fields in email body

Need help populating custom input fields in email body

  • I am using conditional logic drop down based on a number field. So if the person clicks on the number 3…three input fields drop down that will allow each selection to be designated with another variable. It counts the number that is selected and renders the correct number of input fields. The jquery and input fields work fine….but I had to do this in straight code because CF7 doesn’t have any conditional logic functionality that I know of within the plugin…so here is my problem.

    I have my CL input fields and they are ID’d (#). Obviously, there is no shortcode to put these inputs within the email body that will come to me when someone submits the form. I want to see if there is a way for me to call these ID’s into the email body without having to go in and create shortcodes for them. If not, how do I go about creating the shortcode? Here is my code I used for the functionality:

    HTML

    Number of inputs:
    <select class="numInputs" onChange="buildInputs(this);">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
    </select>
    <div class="inputs"></div>

    Jquery

    $(document).ready(function () {
        // set onchange event for the select box.
        $('.numInputs').change(function () {
            // clear any inputs added to the div.
            $('.inputs').empty();
            // get number of inputs to add from select box.
            var num = $('.numInputs option:selected').text();
            // build the inputs.
            for (var i = 1; i <= num; i++) {
                $('<input type="text"/><br/>').appendTo('.inputs');
            }
        })
    });

    Here is an example of the functionality. – http://www.toolboxwebdesign.com/form-test

    It would be amazing if I could pull the inputted information into the email body. Thanks for your help!

    http://wordpress.org/extend/plugins/contact-form-7/

  • The topic ‘Need help populating custom input fields in email body’ is closed to new replies.
Skip to toolbar