WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Dynamic Text Extension
Dynamic email address via custom field is lost when form loads via AJAX (2 posts)

  1. egoldin
    Member
    Posted 1 year ago #

    Hey Chris!

    We exchanged brief notes on Twitter, but I was hoping you could take a quick look at this here.

    Your tutorial was awesome, and exactly what I needed. I run a site for people who organize ski leases, snowpals.org/leases. People submit their ski leases to me, and then I post them so people can contact the organizers. Your plugin was perfect because each ski lease should have its own contact form that goes to an email address unique to that page.

    I'm running into a problem though, because I'm loading the form into a lightbox that pops up via AJAX. Following your tutorial, I have email address stored in a custom field on each post, and when I embed the form on the page via editing my WP template, everything works great! Dynamic email is pulled, form works, email is sent. However, when I embed the form in the lightbox, for some reason, the email address isn't pulled and the value attribute is empty:

    http://www.evernote.com/shard/s31/sh/1577f7e4-34d8-4b01-838c-144d9e07c129/57dddcb5fbba0b0b57124b359a9bf77f

    Any idea how to solve this? The alternative is just leaving the form visible on the page when you load it, but it would be so much cleaner to have it in a lightbox that can be triggered when people hit a 'Contact' button.
    - Evan

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

  2. sevenspark
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Evan,

    My best guess is that the variable, which is available to the post when it is loaded, is not available to the lightbox, which is likely loaded via AJAX. You'd need to find a way to pass that variable again in order for the AJAX process to have the appropriate information. Alternatively, if your lightbox can handle inline content, just print the contact form on page load and hide it with CSS, then display it in the lightbox when Contact is clicked.

    Hope that helps :)

    Chris

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.