DrupalCon Prague 2013

Mejorando las encuestas en Drupal con Webform 4.0

Nathan Haug  · 

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

well welcome everybody to web form 4.0 surveys and drupal improved this session is going to be all about the web form module which I think probably most of you guys are already familiar with it's sort of one of the oldest longest-running Drupal modules

in existence that continues to kind of upgrade and and be relative relevant in each new version of Drupal and the new version web form 4 is an iteration on the current version of web form that I think it will provide a whole bunch of new functionality and

api's that everybody will find useful and powerful a little bit about myself my name is nate Hogg I'm quick sketch on drupal.org and on Twitter and I work for the company lalla bots doing development and consulting for them and recently I also started

a company based around the web form module called web form comm and it's basically a hosted service so if you like the web form module and you have non Drupal sites that you would like to use web form on you can use the web form comm service to empower

your site with all of the functionality web form as a service and it makes it so that you can export it and then move it to a Drupal site at a later point in time so you can export not only data but actually all of the code that powers web form comm into your

own Drupal sites and I think that if you really want to have a nice demo of web form 4.0 you can just go and try it out there because we're kind of running like the cutting-edge version of just about everything that I'm gonna be showing you guys today

on that web site so web form 4 or web form just in general generally widely considered to be like the de facto standard in making surveys in Drupal we're on the cusp of a 4.0 version it's usable right now when I made a Drupal con honorary release just

yesterday that is the beta 1 release the final version of web form 4 will probably be released for the end-of-the-year or targeting for November a big thing about webform that separates it from something like field module is that it's really intended for

your end users to be utilizing and creating forms so like your editorial team the same people that are creating articles and blog posts if they also need to be empowered to build surveys then webform is an excellent choice for that task and because it's

designed for end users it's it's much more direct and less complicated than field module field module when you're constructing all of your content types and fields you're really designing your database schema webform on the other hand dumps

it down a whole lot where it's more about creating a form than it is about creating a database schema and there are some downsides to that but also some up sites that web form allows you to have hundreds or thousands or even hundreds of thousands of forms

on a single site you can have as many web forms as you want as opposed to content types where after you create like 20 or 30 of them it starts getting to have a performance drag on your site and sort of is an implication of that because web form is not based

on field so where entities that also means that generally whenever you you encounter a module that provides like a date field or a time field or something like that that it won't work right out of the box with web form usually there's a companion module

that it's like the web form underscore whatever module like postal code for example like there's there's usually a web form equivalent for pretty much any field out there but if you have one module for fields you'll probably need to have another

one for webform because they're basically separate systems and the difference between web form and fields is that fields generally when your editors are creating content they're creating content by like a few people are creating content that is made

to be digested by a large number of people and web form is sort of the other way around where you've got a huge number of end users who are on the front end of your site maybe even anonymous users and those are the user that are actually going to be filling

out the form and when they fill out the form they're going to be sending these over to the editorial team or the administrative team and the administrative team is really going to be the people that are looking at all of those submissions so end-users

are filling out the form hundreds or thousands of times and it's only being reviewed by like a smaller subset so it's like the reverse basically of what you normally think of for four fields which of course fields can be used in this way too and web

form can be used in the opposite way also but generally this is the way that these these things are meant to be used fields are generally for admins filling out forms web forms are for end-users filling out forms there's an exception to this editorial

team looking at submissions only and that's a user who creates submissions they always or can have the ability to edit their own submissions after they've filled it out so if you've got some kind of system where you want to use it to come be able

to come back and like edit the previous submissions or view them they have the ability to do that but generally end users don't see the submissions of other end users there they're kind of all isolated from each other so the webform interface generally

is really pretty simple when you enable the webform module you'll get a new webform content type that when you create a new webform node web forms are nodes all of all of the webform pieces of content we'll end up with two extra tabs on them one for

webform and then one for results and when you look into the webform tab you'll get a series of sub tabs here the main one is the form components page where you'll actually be listing out all of the individual components that are in it in a particular

form and web form 3 actually some later versions of web form 3 add this functionality but I'll reiterate here because it's in all versions of web form 4 also when you add those new components we've got a couple of new html5 friendly components

now so right out-of-the-box you don't need to install any other modules in order to have webform be html5 compatible we've got support for all kinds of html5 things so normally like if you haven't textfield you get a normal tech keyboard I guess

dreese mentioned this in the keynote this morning too but if you have an email field then you get a different keyboard that just matches the type of data that's going to be input so a plain text field you get like a normal text keyboard and when you have

an email field you get like this keyboard that gives you an @ symbol right there whenever you're on a mobile device I also provide some nice in-line validation so if you type in an email your browser generally will validate that email directly for you

in addition to like an email field we also have a html5 number field which again gives you a special keyboard for individual number components so back on the components page so now we're moving through these tabs basically one at a time if we go from the

forum components where you're generally going to be adding and modifying your forms take a look at the conditionals tab and this is brand new feature in in webform for that I think a ton of people are really going to love and that's conditional support

like really advanced conditional support multiple conditions affecting multiple fields and it works on single page forms so you can say like if a department is something and we're gonna actually do this and in the hands-on demo if a department is something

then hide or show a field set or a field on the same page or if you have a multiple page form then you can hide the field on the next form or you could skip the entire page webform three had some conditional support but it was severely limited you could only

do one action ever and it would only work across multiple pages in web form for we now have same page support and multiple options it's it's a lot better and the interfaces is really great and we'll go through that when we do the hands-on so keeping

moving through the tabs the most common thing people do with web forms is when they when a user fills out the form usually the user wants to get an email or the administrator wants to get an email so web form is a really good replacement for like contact module

if you have a much more elaborate contact form that just says like one or two more fields or if you want to have multiple contact forms for different things like a job application form versus the normal contact form then you can set up a web form for each

of those and have them behave differently so when you set up an individual email in web form you get to choose like whether or not you want to email that to like a specific like hard-coded email address or you can send it to the value of a component so this

is useful and we'll do this during the hands-on like if you want to send one email to the administrator of the website but then you had the user type in their email address when they started filling out the form it's really common you'll want to

send a receipt back to the user saying you know thank you for filling out the form we received your submission here's a copy of it and do that sort of thing so you can make it so that you can send an email to any value of another component on the web form

so we have two types of components that you can send email to like the email component if you want to send the user receipt or if you have a select list this is new functionality in webform for also if you have a select list now you used to have to do this

really weird thing where you would have to use a key the email address you would have to use as the key and then the value of the select list you would have to use as the label which is a really terrible thing on a lot of levels now in web form for when you

select a radio buttons or select list as the destination for an email it does this nice thing where it automatically gives you a whole bunch of fields that match the options in the Select list and you can choose like when this option is selected send emails

to these people and you can come and separate them so you can send like if the user selects some particular category send it to multiple email addresses at the same time also new if you if you were to scroll down further when configuring an email address and

we're gonna go through this at the end we also now have finally finally real Drupal 7 style tokens so all of the normal token ability you now have in web form web form uses for everything and it provides some of its own tokens to make it so you can pull

out the submitted values the user filled out in the form and include that in like the the email templates the confirmation messages the redirect URLs anywhere where there's any text field and Drupal default values you can populate those values with tokens

now which is much more powerful than the old webform 3 style tokens so the form settings page not a whole lot has changed on this page from from webform 3 you still have all of the mishmash settings that you could possibly want to customize the functionality

[ ... ]

Nota: se han omitido las otras 5.694 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.