PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Checkbox on form for confirmation email

  1. dgalfano
    Member

    Is there a way (or possibly to add as a new feature, if not) to have a check box that the user can select when the fill out a form that will let them choose whether or not they want to receive a confirmation email or copy of the form results? I currently only see (in Notifications area) I can include that if I (as the owner) want them to receive this.

    Posted 9 years ago on Tuesday January 8, 2013 | Permalink
  2. We're talking about notification email (referred to in the code as autoResponder) not the confirmation screen online after form submission.

    There is a way to do this, and it has been requested as a feature before as well.

    Take a look at this page:
    http://gravity.chrishajer.com/do-you-want-a-copy-of-your-submission/

    The separate name fields were for an unrelated post. But if you fill out the form, use your real email address and try submitting the form with the box checked and unchecked.

    Here is the code I added to my theme's functions.php: http://pastebin.com/ejPNFDSK

    Let us know if you need help with this.

    [MOVED to regular support forums from Feature Requests]

    Posted 9 years ago on Tuesday January 8, 2013 | Permalink
  3. dgalfano
    Member

    Chris - Awesome! Thanks!

    Posted 9 years ago on Tuesday January 8, 2013 | Permalink
  4. dgalfano
    Member

    I added the (edited for my form/field #) code to my theme's functions.php, and added a checkbox to my form. However, it doesn't matter if the checkbox is checked or unchecked, I don't get any autoresponder email. I do have the notification to user (Enable email notification to users) checked. Any ideas?

    http://jake.oftrades.com/reservations/

    Posted 9 years ago on Thursday January 10, 2013 | Permalink
  5. The autoresponder needs to be set up in the Notifications tab of the form in the first place. Do you have that?

    Did you set a value for the checkbox, and are you checking for that value in line 10 of this code. If not, no notifications would ever be sent since that statement would never be true, and the autoresponder would always be cleared out.

    If so, remove this code, and see if notifications will arrive without any custom code. Maybe there was a problem with notifications before?

    Posted 9 years ago on Thursday January 10, 2013 | Permalink
  6. dgalfano
    Member

    Autoresponder is set up in Notifications and works when the code is not inserted in functions.php.

    I checked the value for the checkbox and it 'had' been the same as the label, but I changed it simply to yes but it still doesn't seem to be working. Form ID and input number are correct.

    Perhaps this theme isn't even using the functions.php? I created this theme a few years ago, I think I took maybe the default theme, changed the name and then added my custom design/css. Where in the files would it access the functions.php and/or is there another place to put the above code that it can be used?

    Posted 9 years ago on Thursday January 10, 2013 | Permalink
  7. If it works properly when the code is taken out of functions.php but not when the code is present, I would say that the theme is processing the functions.php. The file is located here wp-content/themes/jakeoftrades/functions.php

    If you would like me to take a look, please send a WordPress administrator login to chris@rocketgenius.com - please be sure I can edit the functions.php file as well.

    Posted 9 years ago on Friday January 11, 2013 | Permalink
  8. dgalfano
    Member

    Thanks Chris. I just sent you an email.

    Posted 9 years ago on Thursday January 17, 2013 | Permalink
  9. Resolved via email:

    Take a look now and test your form. You had the wrong field ID where you were testing. You had input_4_39, but it needs to be input_39_1 (the form ID is not in this field ID).

    I fixed it and removed the "if defined" part, since that was failing as well. Without that test there, I did not see any PHP warnings, but if you do, let me know and we will test differently.

    Posted 9 years ago on Friday January 25, 2013 | Permalink