• Resolved bbondwvu

    (@bbondwvu)


    I have a form where I need to allow someone to select a country and then dynamically change the next field with the states/provinces for that country. I am able to get that to work properly within the contact form, but I am unable to get those values to send via email. I have tried using hidden fields (using the plugin) etc. The only way I can seem to find to add those dynamic dropdowns “easily” is by using jscrpit.

    So, my question is how do I get values from a traditional dropdown (select) into the email or is there a better way to do this dynamic dropdown.

    the code looks something like this:

    Country:<select onchange=”print_state(‘state’,this.selectedIndex);” id=”country” name=”country”></select>

    State/Province/District:<select name =”state” id =”state”></select>
    <script language=”javascript”>print_country(“country”);</script>
    `

    Thanks

    https://www.ads-software.com/extend/plugins/contact-form-7/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi!

    Firt, you need to insert jquery in your site, after insert this line in the text area field at the bottom of contact form edit page:

    $.getScript(“../wp-content/themes/twentyeleven/js/countries.js”, function()

    Change that path to macth your directory.

    Call the tag in email by name. In your case: name=”country” becames [country] and name=”state” bacames [state]

    (Sorry my English. I’m Brazilian…)

    Thread Starter bbondwvu

    (@bbondwvu)

    This worked beautifully. Thank you so much!!!

    Hi bbondwvu,

    Will you please help me how to generate dynamic country state dropdown.
    I need to allow someone to select a country and then dynamically change the next field with the states/provinces for that country.

    Thanks

    Thread Starter bbondwvu

    (@bbondwvu)

    Hey bbondwvu… I’ve been wanting to figure out… I would like every email that comes in to have the same image attachment (in addition to the ones the users upload). The image could be included in the message body (preferred) or be included as an attachment. Do you know how I would do that?

    Thank-you in advance!

    Jonathan

    Hi bbondwvu,
    Thank you very much for your quick response.
    I have already gone through the link you mentioned and I am able to list countries in my Country dropdown of contact form 7, but I do not know how to call print_state(‘state’,this.selectedIndex) function on onchange event to populate states of a selected country.

    Thanks
    R.K.Sinha

    Hi bbondwvu,
    Country-State dropdown is working fine now. I have used jquery to populate state dropdown.
    Thank you very much for your valuable inputs.

    Hi, I am trying to do this and I came across this post but I’m not completely following how to implement it.

    From what I understand, we must get countries.js to load with the form. It seems we need to add some jQuery getscript to the contact form edit page, but it is unclear where exactly to load it. Can someone be more specific?

    Second, can someone write the exact syntax of the part of code that goes in the contact form 7 itself to call up the country and state list? There are snippets above but they are not complete.

    Thank you for your assistance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Contact Form 7] add values from dropdown's to email (non shortcode)’ is closed to new replies.