Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I tried to find some discussion of this functionality, but could not make this happen with either Webform or by modifying the webform with CCK (the custom CCK shows up as a field on the webform creation page, not as something to add as a component that the webform user submits). So is there a way to have multiple text fields become available to the person who submits a webform? Add another "field" on submission of the webform?
Comment | File | Size | Author |
---|---|---|---|
#62 | webform_expandable_fieldset.zip | 12.17 KB | apatrinos |
Comments
Comment #1
Bartezz CreditAttribution: Bartezz commentedEver succeeded in doing so?
Cheers
Comment #2
bomarmonk CreditAttribution: bomarmonk commentedI haven't tried with the latest versions of Webform, but I have never successfully done this.
Comment #3
Bartezz CreditAttribution: Bartezz commentedalright thanx!
Comment #4
Bartezz CreditAttribution: Bartezz commentedQuicksketch,
I came here to see if there as any news on this but I guess there isn't.
Isn't the feature requested possible at all? Or is it something you're not willing to look into?
It would be brilliant to have an 'add another item' option for an input or maybe even a fieldset with multiple inputs inside it.
I guess backendwise it would be harder to fix this as to serialize the data for such an input would render many functions useless but I would love to see this feature so much. And others with me (marked some posts as duplicate).
What's your opinion Quicksketch?
Cheers
Comment #5
sfks CreditAttribution: sfks commentedI think it would be great too.
Regards.
Comment #6
Boland CreditAttribution: Boland commentedIs there any news on this subject? I have searched the whole internet I think, but can't find any solution... Anyone??
Comment #7
quicksketchNo, 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.
Comment #8
Boland CreditAttribution: Boland commentedIs there another solution, in another module? I cannot find such a thing like this in a module for Drupal :(
Comment #9
Bartezz CreditAttribution: Bartezz commentedThe only option I can think of is to use some jquery.
- First you create, let's say, 10 input fields in webform.
- You hide input #2 thru #10 by css
- Insert a button 'add another' with jquery
- And then .show() #2 thru #10 when one clicks 'add another'
Downside is that you have quite a bit of setting up to do in webform and that it's not really unlimited. It's basically limited by you webform setup stamina :)
Cheers
Comment #10
Boland CreditAttribution: Boland commentedThought of that, but it ain't unlimited indeed :)
With content type fields this is possible, but then every webform submission will become a node. Perhaps that will be the better solution, because it should be really unlimited.
Comment #11
Bartezz CreditAttribution: Bartezz commentedCCK fields would be your only option if it really has to be unlimited... or creating a custom module.
Why is it a problem that every submission will become a node?
Cheers
Comment #12
Boland CreditAttribution: Boland commentedThought that could be a problem :)
Trying using nodes and CCK now!
Thanks for replying! Will post here if i'm ready!
Comment #13
quicksketchMarked #635200: Please add Webforms Repetition Model as duplicate.
Comment #14
rreck CreditAttribution: rreck commentedI need this functionality too, but even a little more complicated. Imagine someone is entering CDs and each CD has a title, artist and songs. I would like them to be able to add another CD or add another song. Any ideas?
Comment #15
quicksketchMoving this back into the 3.x branch (issues all lost lost their 3.x versions when I branched for Drupal 7). The trouble with anything like this is that there is a lot more to Webform than just collecting the information. We need to update the analysis, table display, CSV downloads, and other areas to support such things. In Webform 3, I'd suggest making your own component. Either way this would require a significant amount of effort.
Comment #16
joeybernal CreditAttribution: joeybernal commentedThis would be fantastic for many reasons!
Comment #17
pixel8r CreditAttribution: pixel8r commentedWould you do it for a Klondike bar?
All jokes aside, that would be a wonderful feature to have. We will keep the hope alive...
Comment #18
westie CreditAttribution: westie commentedsubscribing
Comment #19
cpotter CreditAttribution: cpotter commented+1 subscribing
Comment #20
texas-bronius CreditAttribution: texas-bronius commentedI'll weigh in here to say that #9 @Bartezz above had a clever solution. Depending on your needs, my planned a-hack on this for my simple "order system" is to dynamically build a row of non-webform form fields (partno, desc?, qty, Add Row) which, upon submission of the form, concatenates these form fields' values into a hidden webform textarea: not beautiful, but gets it done in my use case.
If you're interested, stay tuned! It's just crazy enough, it might work..
-Bronius
Comment #21
d.holmen@gmail.com CreditAttribution: d.holmen@gmail.com commentedSubscribing
Comment #22
jazzitup CreditAttribution: jazzitup commentedSubscribing
Comment #23
rbrownellSubscribe.
Comment #24
rbrownellMarked #791432: Add row of grouped fields dynamically as duplicate.
Comment #25
rbrownellA multigroup function similar to that of CCK's multigroup would be ideal. I need individuals to be able to submit table - like data via email and not necessairly have the data stored on the server the way CCK does.
I am including this apparently redundant post because the word multigroup does not appear in it at all and therefore when seaching the issue queue for this issue it did not appear in the search results.
Comment #26
dharper CreditAttribution: dharper commentedSubscribing.
PS L O V E webform!
Comment #27
malleziesubscribe
Comment #28
sourcesoft CreditAttribution: sourcesoft commentedreally need it at this point
Subscribing
Comment #29
Bartezz CreditAttribution: Bartezz commentedGuess that 'at this point' there still is no solution other than the ones given above.
Don't think quicksketch is likely to develop such a feature because we 'need it', it's rather complicated as described above!
Cheers
Comment #30
Darkplek CreditAttribution: Darkplek commentedIf anybody knows how to achieve this functionality, either via webforms, or another module, or by writing it from scratch, I'd be very, VERY grateful to hear it. I'd love this functionality to be implemented, but since it's not, at least currently, I'm needing suggestions for alternate solutions.
For example, any information on how a solution as described in #20 could be made would be of great use.
Comment #31
Bartezz CreditAttribution: Bartezz commentedDarkplek,
Quick reply;
- add a hidden field to your webform
- use hook_form_alter in a custom module to add the non-webform field(s) to the webform
- use drupal_add_js in a custom module to add jquery magic to the webform
- through that jquery the user can clone the non-webform fields as many times as he/she needs it
- bind a function to the webform submit button that reads all the data from the cloned non-webform fields and inserts this list of data into the hidden webform field
Cheers
Comment #32
span CreditAttribution: span commentedThanks for your input Bartezz, I'm also looking to do this. I will post back my code if any of it can be used when I'm finished.
Comment #33
span CreditAttribution: span commentedI had 10 fields in the fieldset that I need to be able to show to the user on demand.
Heres my javascript that i added to a file to add fields and then take their data and put it in a textarea which is set to display none.This solution turned out uglier than I had hoped and made it very hard to get at the data submitted without writing som PHP to go with it.In the end I went with a solution where I added 20 fieldgroups to the webform itself within a wrapper fieldset to be able to target the children, all fieldsets containing my 10 fields, and then I used the second script to hide them all except the first one, add a button to display another fieldset etc. Since the adding and hiding is all done with scripting, all fields will be displayed to a user without JavaScript enabled which is a good thing.
And I ended up with:
Comment #34
Bartezz CreditAttribution: Bartezz commented@span; Ah this a solution based on my comment in #9, nice. Thanx for sharing, hope it helps others.
Let's hope Darkplek works out a solution based on #31 and shares it as well :)
Cheers
Comment #35
Dubs CreditAttribution: Dubs commentedI've added the code fromn #33 as suggested (using drupal_add_js and referring a file). However, I get "This is not a function" from Firebug when trying to do so and things don't work as expected. [themename] was changed to the name of my theme too.
Comment #36
mcpuddin CreditAttribution: mcpuddin commentedI highly recommend the in-dev version of the module field collection, you can do all you want to above using nodes. Check it out, http://drupal.org/project/field_collection
Comment #37
TechNikh CreditAttribution: TechNikh commented+1 subscribing..
Comment #38
texas-bronius CreditAttribution: texas-bronius commentedI see I neglected to followup with my own jquery hack proposed in #20 above. It ended up being really inelegant, and the results are, after all, crammed into a TEXT fields in the database with built-in delimiters to boot. What is this, a backward IBM Universe Multivalue DB? Yikes-- no thanks.
Sorry not to be of any more help here.. I can see quicksketch's point and that webform is not architected for this. So I wanted to further the discussion of, potentially, a non-webform solution: has anyone taken this to g.d.o yet? I would like to talk about "anonymous can post a cck/entity and then any number of nodereferenced subitems." We would obviously miss out on all the cool webform survey results, but Views could be whipped together, right?
Comment #39
ktleow CreditAttribution: ktleow commentedSubscribe
This feature would make Webform uberawesome.
Comment #40
kranklin CreditAttribution: kranklin commented@span Thanks for your code however it caused an error when I used it. My fix was to remove the object with the 'attach' function and assign the function directly to Drupal.behaviors.["THEMENAME"]. Here is my code with some changes:
Comment #41
achrelam CreditAttribution: achrelam commentedHello,
The button to append a new fieldset doesn't appear. The Js script is loaded, but there is no action on my container #webform-component-MINE.
Do we have to create e.g 10 fieldsets, hide all except the first one ?
Thx a lot.
Comment #42
ain CreditAttribution: ain commentedShould be standard functionality in Webform. Subscribing.
Comment #43
quicksketch@ain: Use the "Follow" link at the top of the page instead of subscribing.
Comment #44
john.money CreditAttribution: john.money commented+1 for the
patchapproach in #40.Note for anyone implementing, I got this to work perfectly with a selector like this:
Comment #45
shimba CreditAttribution: shimba commentedsorry John but I am new at this. kindly tell me where to insert the code.
Comment #46
Pongolyn CreditAttribution: Pongolyn commentedSubscribing
Comment #47
john.money CreditAttribution: john.money commentedShimba, you will need to create a new JS file like in #40 and then include it on the page(s) you want. There are a few different ways to do this (via custom module, your theme, etc) that are really beyond the scope of this thread. If you are really stuck, email me with your drupal version, the node ID for the webform, and I'll whip you up a small module later this week.
Comment #48
john.money CreditAttribution: john.money commentedGot a few emails about this, created a small module Webform Add More based on approach and code provided by span and kranklin. All credit goes to them.
Comment #49
quicksketchNice one John Money!
Comment #50
Bartezz CreditAttribution: Bartezz commentedNice work John! And thanx for the credits :p hehehe
Cheers
Comment #51
john.money CreditAttribution: john.money commentedOuch! Sorry I missed you in credits Bartezz. Fixing on project page.
Comment #52
Bartezz CreditAttribution: Bartezz commentedCheers :)
Comment #53
mohann2009 CreditAttribution: mohann2009 commentedWhat i'm missing? installed smoothly on my system. Add more option is available in the fieldset but i can't find add more button when webform is saved. badly needed this feature.
Comment #54
blauerberg CreditAttribution: blauerberg commentedSubscribing
Comment #55
droprocker CreditAttribution: droprocker commentedSame here like at post #53.
I'm working on a Drupal 6.26 installation and the 6.x-1.03 Version of the module. Please help! I really need this functionality. I would appreciate any help...
Comment #56
rbrownellChanging back to feature request... this can't be a support request because this feature does not exist yet.
Comment #57
rbrownellChanging back to support request...
@missingdot check out this module http://drupal.org/project/webform_addmore
Closing this because it appears to be resolved... Any issues with functionality of the 'solution' module should be posted directly to the issue queue for the webform_addmore module.
Comment #58
mallezieI see that the functionality of webform_addmore could be used.
But this is actually a hack.
Shouldn't we keep this issuu open to make a true 'add another' functionality like field_collection does.
Add more is a nice temporary solution, but is actually 'hide some fields'.
Full respect to John Money, span and kranklin. Nice work.
Real 'add another functionality is a huge undertaking', but i wouldn't call this issuu closed. Marking to postponed on #118984: Field API based rewrite of webform module
Hoping that one day we truly could get this done. If you think this is fixed, you can set this back. But wanted to point out my concern.
Comment #59
lsolesen CreditAttribution: lsolesen commentedComment #60
rbrownellI would have to agree with you. I must admit I didn't thoroughly check out the other module.
-R
Comment #61
jmrivero CreditAttribution: jmrivero commentedIm wondering if its possible that instead of create 20 fields and hide them, create the fields dynamically on request to add another, even if it means shove it in the database as another field of the form each time the current amount of fields is not enough for the user filling the form, then for another user, use the same hide functionality as used now.
So the steps could be:
- user fills the field
- user clicks "Add more" button
- call the function to add a new component to the form via ajax ( punch the new component in the webform database )
- retrieve the new component and alter the form
- repeat until done
And for another user:
- hide all the components but one
- user fills the field
- if more needed, show another from those saved in a previous submission
- if not enough components call the function to add a new component ( punch again )
- retrieve new component and alter form
- repeat until done
In the end, as the new components are inserted in the webform there should be no need to modify the reports thought.
So my doubt is if it is possible to "Punch" new components like this in webform.
Comment #62
apatrinos CreditAttribution: apatrinos commentedI've been working on an implementation of an 'expandable' fieldset component for drupal 7 and webform 3.x. The module essentially tries to piggy-back on an existing webform by dynamically creating an 'Add Another' and 'Remove Last' buttons to which AJAX callbacks are attached, which create a copy of the existing fieldset's original children giving them new field keys etc. The extra values inputed by the user are saved in module-specific table. I've gotten it to work more-or-less, but there are some important drawbacks that must be addressed:
1. When re-editing an existing field the new values are not retained.
2. After re-loading an existing submission for editing, the 'add another' functionality breaks, field values become confused.
Perhaps someone more experienced with the form API and/or webform might want to take a look...
Comment #63
cmspagnola CreditAttribution: cmspagnola commentedI tried installing your module (I have version 3.18 of webform), but it says I don't have QA_Utility...but I can't seem to find any module with this description. I'm not incredibly familiar with drupal, and so this might be a stupid question...but what is QA_Utility and how do I get it?
Comment #64
shakeeltariq CreditAttribution: shakeeltariq commentedSubscribing
Comment #65
Liam MorlandComment #66
DrupalDan CreditAttribution: DrupalDan commentedsubscribing
Comment #67
cconant CreditAttribution: cconant commentedPatrinos, I also tried installing your module and ran into the same issue. I am also new to Drupal, and couldn't find the QA_utility module anywhere. Can anyone help out with this?
Comment #68
lunk rat CreditAttribution: lunk rat commentedMulti-value, grouped, 'compound fields' with an "Add another item" button can be achieved with Drupal 7 + EntityForms + Field Collection:
http://drupal.org/project/field_collection
http://drupal.org/project/entityform
I opted for this rather than trying to get Webform to work.
Comment #69
mdburrell CreditAttribution: mdburrell commentedsee simple solution to add more fields to a webform.
Comment #70
oncreative CreditAttribution: oncreative commented@lunk_rat #68 - Any chance you could expand on your solution a bit more?
I've created an entity form and a fieldset with a field in it but can't see how get it to dynamically add more fields in the fieldset via an Add Another button. Or how to add a button at all for that matter. I haven't discovered what you mean by "Multi-value, grouped, 'compound fields' ". All I need is for someone to add any number of additional text fields.
Comment #71
lunk rat CreditAttribution: lunk rat commented@oncreative: On your field, do you have the "Number of values" set to "Unlimited"?
Comment #72
mmomin CreditAttribution: mmomin commentedWebform Matrix Component module can be helpful to those who are looking for "add more" functionality for webform component.
Comment #73
DanChadwick CreditAttribution: DanChadwick commentedSee the Webform Multiple project or Webform Matrix Component. If there is an effort to incorporate "multiples" of each component type into webform itself, that would be where it would most likely come from one of these modules.
Please re-open with a patch if you have a comprehensive solution that is ready to be incorporated into the latest development branch, currently 7.x-4.x.
Comment #74
gaurav@mapmytalent.in CreditAttribution: gaurav@mapmytalent.in commentedenhancing number of field in drupal 7 webform
Comment #75
gaurav@mapmytalent.in CreditAttribution: gaurav@mapmytalent.in commentedI am not able to add field in drupal webform