Closed (won't fix)
Project:
Webform
Version:
6.x-3.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2009 at 23:20 UTC
Updated:
7 Feb 2012 at 18:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
daengo commentedI found the answer.
Find the file in the components folder for your component (i.e. select.inc, textfield.inc, textarea.inc, etc). Open the file and find
function _webform_csv_headers_ (the function will be different depending on which component type. For example function _webform_csv_headers_select for a select component). Change $header[2] = $component['name'] to $header[2] = $component['form_key'];. This must be done for all component types in your webform. Go back to the file download. Download the file and the form_key will be in the headers instead of the 'name'. You could also decide whether to remove the extra headers or leave them.
Comment #2
jeffamSorry if I should have opened a new bug rather than resurrecting this one, but I had the same issue, and I solved it the same way, but as an option rather than a complete replacement.
Here's the patch. Hope it's useful to someone.
Comment #3
quicksketchInteresting, thanks jeffam. I'm not sure about adding this as an option but I'll give it a try and see how it looks. Thanks for the patch!
Comment #4
quicksketchI looked at this issue again and I don't think it's an option that I will be adding to Webform. Thanks for the patch but options like this are likely more obscure than they are helpful.
Comment #5
mstrelan commentedThis is really helpful for me. I have many fields with the same name, but the user can enter in 4 or 5 different values, so I am differentiating between them with the field key. Now the client wants to mail merge in to a Word document and its rather troublesome trying to map to the right field.
Patch in #2 applies cleanly and seems to work well.
Comment #6
johnlaine commentedI agree with post#5. I use a webform to collect data to use with a word doc mail merge to create closing documents on the sale of a home.
I use fieldsets to make the form easier for my customers to enter the data but this means I have many duplicate fields, such as "address" (one for the buyer, seller, property itself, etc)
The Field Key is unique so this makes things a lot easier than using the Label which is not.
Comment #7
jeffamI still need to maintain this patch for one of my clients, so I finally fixed up a sandbox repo that tracks the main webform releases but includes the changes I made to allow using fieldkeys as exported CSV headers.
Sandbox is here: http://drupal.org/sandbox/jeffam/1215106