WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 Dynamic Text Extension » [Resolved] Populating field on contact form popup with title of item in catablog gallery

[Resolved] Populating field on contact form popup with title of item in catablog gallery

  • Hello,

    I am not very good on php and am trying to do a very complex thing for me, and I am not sure if it is possible with this plugin, but I think it is, thats why I put the question.

    The problem:
    I have a Catablog collection of items displayed in a gallery. In every item (product) I have a CONTACT link which links to a pop up contact form. I want this contact form field (product), filled with the product title.

    The way I display the contact form in a pop-up in the catablog gallery is this

    1. create a contact form whose shortcode is this one: [contact-form-7 id=”170″]
    2. Add a new token named %CONTACT-FORM% to Catablog plugin: hacking the CataBlog.class.php file and adding in line 2572 the following line: $values[‘contact-form’] = do_shortcode(‘[contact-form-7 id=”170″]’)
    3. In the Catablog template I add the following code:
      <a class="fancybox-inline" href="#contact_form_popup">CONTACT</a>
      <div class="fancybox-hidden" style="display: none;">
      <div id="contact_form_popup">
              %CONTACT-FORM%
      </div>
      </div>

      so it displays the contact form in a pop-up whenever I click on the CONTACT link in the Gallery.

    The problem comes here, I am not able to populate the (product) field in the contact form with the item title, which is what I want to do.
    I have tried with this shortcode: [dynamictext dynamicname “CF7_get_post_var key=’title'”] but it takes the page title, not the product title.
    I am also able to get the product title with the token %TITLE% on the template, but I dont know how to put it on the contact form pop-up…

    Any ideas?
    Thanks in advance!

    PS: catablog version 1.6.4

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author sevenspark

    @sevenspark

    Assuming you have a single contact form which is generated on page load, you’re going to need a javascript solution (which isn’t something this plugin does).

    Keep it simple – have a data attribute for each gallery item, when it is clicked, set the value in the contact form via javascript.

    Hope that helps,

    Chris

    Thank you very much for the answer, at least I know I cannot continue thsi way and I can try another. My javascript knoledge is null…
    I will see how to manage to do it.

    Thanks for your great work in the plugin and being so quick solving our doubts!

    Well, I give it for solved as it is not possible to solve my problem via the plugin.

    Plugin Author sevenspark

    @sevenspark

    You’re welcome 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Populating field on contact form popup with title of item in catablog gallery’ is closed to new replies.
Skip to toolbar