. How to create a single item checkbox (sign up for newsletter) with Webform
2. We're not going to make this mandatory, and let's go ahead and click 'Add. ' You can probably figure out how to do this pretty quickly at this point. There are two things that we'll need to do.
3. The first is to hide the label. Let's go ahead and jump over to the mockup to take a look. So we're editing this item right here, and notice that we don't have a label so we should hide that.
4. And we have a single option that's a checkbox, meaning that it's optional; someone can either turn it on or turn it off. We've already selected for it to be nonmandatory, so let's go ahead and take of the label and take care of the option. Go ahead and jump back to your browser and scroll down.
5. You've already set up the label, the field key was set up for us, we are not going to put a default value or description at this point. Scroll down a little bit more. This is not going to be a multiple option, there's just going to be a single option.
6. And let's go ahead and specify our option. So note that we have a key on the left hand side that uses some underscores in order to separate the words, and it's all lowercase. And then we have the value that's going to display next to the checkbox here.
7. OK. Let's go ahead and scroll down a little bit more. We're not going to have any validation.
8. We also need to hide the component tile. Let's go ahead and check this and submit it. OK.
9. So we should have a pretty functioning Webform at this point. Let's go ahead and click 'View' in order to take a look. OK.
10. Scroll down so we can see the whole thing. OK, so we have our name, we have our email, our experience level and if we take a look at the options here we have basic, intermediate and advanced. Good.
11. We have our comments and we have our sign up for newsletter, though it's a radio button instead of a checkbox. And the downside to this is that once we check it, it's not possible to uncheck it again. So we need to switch this over to a checkbox.
12. And to do this, we kind of need to trigger a property of this input that seems a little counterintuitive. That multiple option where we can select multiple for, say, a select box'in terms of a select box, it would make a whole lot of sense to allow multiple selections. For this we only have one option, so to enable multiple seems a little strange, but this is a workaround.
13. Because radio buttons are for single selections and checkboxes allow for multiple selections, we can turn it on in order to make this a checkbox. So let's go ahead and do that. I'm going to scroll up to the tabs here and click 'Webform.
14. ' And we're going to edit this input here, 'Sign up for newsletter,' so I'm going to click edit. I'm going to scroll down to where you see 'Multiple. ' And let's go ahead and check this, save it, and let's view again.
15. I'm going to scroll down. OK. Now we have our check box.
Explore the most important concepts and techniques for site building in Drupal. In this collection, we take on a practical, real-world example and walk through creating and managing content, working with users and installing and configuring modules. A few highlights:
- Build a fully functional calendar page
- Add rich interlinking between pieces of content
- Learn how to evaluate modules, install and upgrade them