1

I need to have a way to allow for multiple values to be used for a field.

For example,

Someone has school name(s), and the form description says, "Add your schools here."

I add a school, press a button for an additional, another text field appears, etc.

I know I have seen this before, but I cannot seem to find it anywhere. How do I do this?

I thought it might be this module(s):

https://www.drupal.org/project/field_collection

https://www.drupal.org/project/webform_addmore

How to add additional "items" on a webform in Drupal 7

But I'm not sure. I thought it was built into Drupal webforms.

  • I never tried it. – johnny Jun 13 '16 at 17:21
  • Well, then you don't know what you're missing, really! If you ever get a chance to do so, give it a try (and let me know if I was right ...). – Pierre.Vriens Jun 13 '16 at 17:24
  • Does it work in 8? – johnny Jun 13 '16 at 17:30
  • It's getting there: drupal.org/node/2633094 ... – Pierre.Vriens Jun 13 '16 at 17:32
  • Are you the author? – johnny Jun 13 '16 at 17:34
2

If you want to allow a field to get multiple values.you need to edit the field and allow the numbers of values to unlimited. Suppose you want to allow multiple images to upload in Article content type.

1)Go to Administration » Structure » Content types » Article » Manage fields 2)Edit the field and under field settings,choose the values to unlimited or number of values you want a user can upload. See the similar in screenshot url below. https://www.evernote.com/shard/s496/sh/15655bf1-104c-40ed-ab26-bc6da6ebe7a5/bd1bce151edec9956746845474f3ba95

  • This did not allow me to publish the form so the user can add multiple entries, only when I create the form. – johnny Nov 15 '14 at 15:21
  • Would you please elaborate a little bit about the "form" You created the content type.For creating the content edit go to node/add page and create the pages of that particular content type. – Naveen Valecha Nov 15 '14 at 15:49
  • I created a content type under Webform, "Last Name." – johnny Nov 17 '14 at 14:56
  • Do you want to say that you have created a last name field under the webform content type ? – Naveen Valecha Nov 17 '14 at 15:10
1

There have been a number of attempts at this using the webform module, ex:

Webform Multiple https://www.drupal.org/project/wfm

but these are a little buggy and unstable at the moment, primarily because of the bespoke way that webform handles its data.

An alternative you should consider is switching to entityform:

https://www.drupal.org/project/entityform

which leverages the robust Entity API for handling data and creating fields. You will then have hundreds of Drupal field types to choose from, most of which could be made to 'add multiple' as you would for a normal content type.

  • If I use add multiple, will it put that on the form the user filling it out sees? I tried that with regular webforms and couldn't see it on the form the users sees, only when I create the content, new webform. – johnny Nov 15 '14 at 15:23
  • yes- this will work with entity form and any field built off of the entityapi but the 'add multiple' functionality is not tied to webform. Try entityform module instead and create your fields to allow multiple values, this will then be displayed on the form the user sees. – schnippy Nov 15 '14 at 20:03
1

The way we have done this is to replicate the fields, or even the fieldset, and then use Webform Conditional statements (this is now in core webform module, you don't need the extra module)

You then make a field that says 'add extra' and if they set it to 'yes' you make the next set of fields visible via the condition

Hope that helps

1

The Select (or other) module provides the functionality similar (or identical?) to what you are looking for. Here is an excerpt about it from its project page.

Provides a new Forms API element which is a select/radios/checkboxes element that has an 'other' option. When 'other' is selected a textfield appears for the user to provide a custom value.

You could "start" from a few schools (school 1, school 2, school 3), and whenever somebody needs another one (not in the list yet), they just enter "school 4". Here is a sample about it (just replace "Option" by "school" to get the idea):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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