Domanda

Simple question for all of you here dealing with Drupal 6.x...

With Drupal's Add More module, is there a way to configure my webform so that there is no limit on how many of a specific fields I can add more of?

Please see my image for example:

enter image description here

For example, I'd like to enable the user to add as many titles as they would like. Is that doable?

È stato utile?

Soluzione

Unfortunately, it's not currently possible to add unlimited "add another" functionality with webforms. And if this functionality does become a reality someday, I doubt it will be backported to the Drupal 6 version of the module. From the webform modules author (quicksketch):

there is no progress on this subject. The ability to support multiple values requires a tremendous amount of re-architecting, including changes to the way CSVs are generated, analysis, the database structure, and the UI (both for administrators and users). I wouldn't expect this feature to be added any time soon.

See this thread for more information: http://drupal.org/node/354381

I would suggest using a node and the CCK module plus rules and views to collect this information.

Assumptions:

  • Anonymous users can fill out the current form
  • You need some way of retrieving the data that is submitted
  • Regular users of the site should not be able to view submissions

Very loose directions:

  1. Create a content type and add all of the fields that your current webform contains to it. CCK has the ability to store unlimited values out of the box. On the field settings page, inside the Global Settings fieldset, select "Unlimited" for the "Number of Values" field.
  2. Give anonymous users permission to Create [your-new-content-type] Content on the Role Permissions page.
  3. Using the Rules module, create a new triggered rule that fires on "Content is about to be viewed" with an condition "Content has type [your-new-content-type]" and an action of redirect to homepage (or a custom error page that you created). (Note: this is a bit of a performance hit. There are better ways to restrict access to this content type, but for the sake of this tutorial, this was the easiest to explain)
  4. Using the Views module, create a new view with Style set to Table. Add each of the fields in [your-new-content-type] in the fields section. Under "Access" choose "role" and select the role that is assigned to your user. Add a "page" display, give it a Path and save. This is the page you will use to view submissions.

Optional:

  • Use the Rules module to send yourself (or the submitter) an email when a node of [your-new-content-type] is created.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top