2

I'm using D7, and I want to create a newsletter subscribing page with simplenews module.
Other than email column, I want to have fields like name, address, contact number, select field (checkbox) in the form, like in the link below

http://bsgproperty.com/registration_form.php

However, I found that simplenews is hard to add in fields, so I decided to use webform to create fields and add in a checkbox to subscribe newsletter.

I had successfully created a checkbox, but how can I link this checkbox to newsletter module?

I want the email address entered in webform to be added in newsletter subscriber list after users check the checkbox and submit.

Is there anyway to do this?

2 Answers 2

2

If you want to add a checkbox field using the Webform module...

Choose the "Select options" type, enter the value and label, then choose the "Multiple" setting (even if you just want one checkbox to appear), and make sure "Listbox" option is not on.

enter image description here

3
  • but how should I link this to newsletter module? As I want after user check the checkbox and submit, email entered in the form will be added into newsletter subscriber list.
    – vences
    Jun 26, 2015 at 3:12
  • Which newsletter module are you using? Most come with their own subscribe forms. Jun 26, 2015 at 3:39
  • I'm using simplenews. It provides a subscribe block with email address, but I need to setup extra fields like phone number, address, etc in the form.
    – vences
    Jun 26, 2015 at 4:42
0

If writing a custom module is an option, and you need to do a custom integration of Webform with another module, you can:

  1. Implement the form_alter hook to add a new submit handler to the webform client form.
  2. On the submit handler do any actions to subscribe your user (or any other actions you need to do). Read the code in the newsletter number to learn how to register a new subscriber; it shouldn't be too hard.

Here is a gist with a bit of example code and comments: https://gist.github.com/noel-rivas/6fc0de57b31ca8c6885db06c92bffab0

This is an old question, and this is a very generic answer of how to use webform submitted data to accomplish some other action, but it might be helpful to you, or others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.