In many cases, the field will be used on a contact form which already provides a (required) e-mail field.
From a usability point of view, it would be a great improvement if there would be a checkbox instead of input field, and the email value would be populated from the already filled in mandatory e-mail field.
This should be possible because you can detect whether a field is an email and/or required. So a select-box could be offered:
--- email input (default, current situation)
--- use emailaddress #id
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | webform_simplenews_d6.zip | 10.38 KB | juliusvaart |
| #2 | webform_simplenews.patch | 6.51 KB | hotspoons |
Comments
Comment #1
Anonymous (not verified) commentedFirst, great work and great Idea! Thank you for your effort in creating this module which fills quite a gap in functionality for the regular end users.
I agree with that. In probably 90% of all cases, people would want to expose the options to select newsletters to subscribe to, using another field which provides the email adress. Another "mainstream" usage scenario is the classic "Yes I want to subscribe"-checkbox.
Like:
If checked, the email adress will be subscribed to the previously defined newsletter on submit. E-Mail field has to be defined as a required field tho. The component might aswell take the last email-field which is set to be required as a default option to reduce configuration overhead and offer customisation otherwise. The email field already provides the "prefill with users email adress".
This is actually not much different than exposing all newsletters as a checkbox group, all that changes is the label of the checkbox. Things which should be configurable are which newsletters to display and the labels of each checkbox/newsletter.
Best regards!
Oliver
Comment #2
hotspoons commentedI attached a patch which should operate almost exactly as described/requested above. On the webform component editing page, the newsletters selection box is now a multi-select box; by default, you can now subscribe a person to more than one newsletter using a single text entry field by selecting multiple newsletters in the component configuration. This leaves the current visitor-facing UI the same, but allows more functionality on the back end.
There is also an option to "Allow individual selection of newsletters"; this will display a list of newsletters the visitor can subscribe to as a list of checkboxes, populated from what was selected in the component editing screen, so for instance, one webform can display the option to subscribe to newsletters A, B, and C, and another webform can display the option to subscribe to X, Y, and Z.
Please review and let me know if it works out. Thanks!
Comment #3
pcambraThanks for the patch hotspoons
As I don't really need this for my project, my test wouldn't be enough, let's see if the rest of people that were interested in this can test it and I will commit it.
Comment #4
Sile commentedThanks for this patch hotspoons - it's functionality is exactly what I was looking for. Am testing it out - so far so good :-)
Comment #5
Peter76 commentedThanks for the patch. Its work great.
But there is just one problem. When I submit webform it shows blank page (no thank you page). Also when you confirm your subscription it shows blank page.
Comment #6
Anonymous (not verified) commentedThanks for the patch!
I gave it a try on my testsite and I think it would work rather well for a form which is focused on handling newsletter subscriptions. I didn't encounter any problems or bugs so far, seems to work well! The "page not displayed" thing from #5 doesn't happen here.
Other feedback/questions:
- I think it would be helpful to add an option which allows you to disable the built-in email-field of this module and use the standard webform-email field as source for e-mail adresses instead. This would create a much more flexible module. From a user perspective, if you are on a contact form and you need to enter your email adress twice - once for contact purposes, once for email subscription - nobody is ever gonna do that lightly, the "annoyance threshold" is a bit high. Which is bad. :-)
- Any idea how one could make it so that one could change the label of the checkbox for each item - and also show the checkbox if only 1 newsletter is selected, but with a different label? Something like "[ x ] Yes, I want to receive your news."? Like, prepopulated and piped item list in a text field instead of selection fields?
- The resulting form contents aren't listed in the webform result page (selection/adress) is that a limitation or not implemented on purpose?
Comment #7
freatida commentedThe patch is working fine for me, thanks hotspoons.
The original request of this issue to have the option to have a checkbox instead of textfield for email address would be very very useful. Has anyone managed to implement this?
Comment #8
pcambraHi guys,
As I'm not going to need anymore than the current code published in the project, maybe one of you wants to take care of the project (hotspoons?) and the new features required.
Let me know what you think.
Comment #9
mstrelan commentedsubscribe (+1)
Comment #10
mstrelan commented#2 works for me, but the patch didn't apply so I had to apply the changes manually.
Comment #11
juliusvaart commentedTo add the SimpleNews email address as the sender address change line 14 in "webform_simplenews.module"
from:
'email' => TRUE,to:
'email_address' => TRUE,Now you can use it as a 'standard' email address.
Comment #12
hotspoons commentedI'll take it on. I have a CVS account - what else needs to be done?
Comment #13
pcambraThanks hotspoons
I've granted you access to CVS so you can commit the project!
Comment #14
pcambraCommited the patch by hotspoons, thanks
#11 that is commited as well in a previous patch today, thanks.
Marking this as fixed
Comment #16
joecanti commentedHi,
I'm using the Oct 4th dev version but I dont see an option to add this as a check box..I can only add an email field which gets filled in...am I missing something simple?
Thanks, Joe
Comment #17
Wallack commentedduped
Comment #18
Wallack commentedduped
Comment #19
Wallack commentedduped
Comment #20
Wallack commentedOk, I solved my problem:
I wanted to be shown the checkboxes even if only one newsletter is available. Also I wanted to be able to customize the label for each newsletter.
What I've done so far (maybe someone can add it to a patch or whatever):
simplenews_admin.inc
I've created a new field under the name (line 154):
As you can see is a text to describe what would be the label of that newsletter if shown somewhere.
Same file, around line 290 (after the previous addition):
variable_set('simplenews_checkbox_label_'. $tid, $form_state['values']['simplenews_checkbox_label_'. $suffix]);
This will save the content of the field and can be retrieved.
Now with other file:
webform_simplenews.inc
Around line 156 changed this:
To this:
This will show the checkboxes if there are more than one newsletter and instead of the newsletter name will show the newsletter label previously added.
Comment #21
snlnz commentedAny chance of a D7 patch? :)
Comment #22
smitty commentedWhat's about the initial feature request?
To get a checkbox instead of input field and the email value would be populated from the already filled in mandatory (webform) e-mail field.
Comment #23
juliusvaart commentedWell, that is what this does for me... a checkbox. Works perfectly.
Comment #24
smitty commentedThen I must be doing something wrong!
With only one Newsletter I only get a e-mail-Field where I can enter the E.Mail-Address (already entered in an webform-e-email-field) again.
With two Newsletters I get an e-mail-Field and additional two Checkboxes (one for each newsletter).
Comment #25
juliusvaart commentedDid you use the comment #20 code?
Comment #26
juliusvaart commentedMaybe it's already implemented in the 6.x-Dev version...
Comment #27
smitty commentedYes, I tried the code from comment #20.
The only thing what this code does, is to enable the checkbox even if there is only one newsletter. But it does not remove the input field for the e-mail-address.
And if you enter an e-mail-addess this address is used for the newsletter, no matter it the checkbox is checked or not.
Moreover it's not possible to get the e-mail-address from an other e-mail-field (webform).
So my result: this is not working at all!
Comment #28
juliusvaart commentedDid you change the code as described in comment #11?
Comment #29
smitty commentedThis code is already in the module:
Comment #30
juliusvaart commentedWell, i've tried it again, and it's working fine.
Attached is the module i'm using.
Comment #31
juliusvaart commentedYou should use the newsletter e-mail field. It works just like the webform e-mail (if code from comment #11 is used). You could populate it with a token and hide it using CSS display: none if that is what you want...
Comment #32
smitty commentedHow can I populate the newsletter e-mail field?
As far as I webform does not provide any tokens and the newsletter e-mail field does not have a input filed to insert a token.
Comment #33
juliusvaart commentedI see, the Newsletter E-mail field doesn't have a field for Default value... won't be really hard to implement i think.
In your first post you write:
But you can replace the standard Webform e-mail field (i believe that s what you are referring to with the mandatory field) with the Newsletter e-mail field and use that as the standard e-mail field (instead of the one you already had, so you can delete that one).
Or do you need other functionality? Maybe i don't understand...
Comment #34
smitty commentedI've tested your module from #30 on a new D6-Installation and this works fine, indeed! Thank You!
So it must be a version-issue, since I am using D7. Because this port was done after #14 I thought that this should also work for D7. Apparently a wrong conclusion.
The issue in D7 is - after all - that a confirmation e-mail is sent, no matter if the checkbox is checked or not.
A minor issue (even in D6) could be, that it would be nice if we could see in the results if the Checkbox was checked or not.
I will go into the code and have a look what changed between D6 and D7. But I need a few days for that, because I have to do other things first.
Comment #35
juliusvaart commentedI haven't had the need for this module in D7. Would be great if you'd post a patch!
Kind regards, Julius
Comment #36
drupa11y commentedAnother cool feature would be the possibility to sort the order of the newsletters.
Comment #37
smitty commentedAll I had to do, was to apply the code from Checking no newsletter will subscribe to all to function _webform_submit_newsletter_email.
Now it works fine!
Could someone commit the change from #20 to the D7-branch please?
Comment #38
snlnz commentedCan this or has this been patched to the d7 branch? I don't see the option of a check box for newsletters with the latest dev release?
Comment #40
snlnz commentedCan this be re-opened until confirmation that it exists in D7 branch?
Comment #41
RunePhilosof commentedComment #42
techman-1 commentedGreatly appreciate the work and time from the developers on this module.
This thread goes back many years through multiple builds of this module and Drupal.
Can anyone elaborate and post up-to-date and concise instructions on how to add the single checkbox feature. I have a webform and I just want to provide a single checkbox for the visitor where a checked box adds the e-mail address they submit to the list of subscribers for my Simplenews newsletter.
Thanks!