9

I inherited a complicated Webform with several hundred submissions. One of the components was a Textfield used to capture the email address of the form submitter. For some reason this is a Textfield and not an E-mail field which prevents me from using the E-mail address to send a confirmation email.

If I were to delete the textfield email component what would happen to all the data? I'm assuming it would be erased.

Is there any way to change the type of a form component while still preserving the data?

Update: I am using Drupal 7 and Webform 3.19

  • Are you using the Webform module for Drupal 6 or Drupal 7? – Aiias Jun 15 '13 at 21:03
  • Drupal 7. Sorry should have mentioned that. – Kevin Morse Jun 15 '13 at 21:58
  • In Drupal 7, there is a place to change the field name in the database. But I'm not sure how to do it – AgA Jan 16 '14 at 4:41
2

When a Webform component is deleted, the submitted data for that component are deleted. The data for the form's other components are preserved. I've confirmed these by querying the webform_submitted_data MySQL table on Webform 7.x-3.23.

As user calebtr indicated, there's a "Private" checkbox for each component that can be used as an ersatz delete-but-save-the-data feature, except that logged-in users with the privilege to read results will still see the component on the form (not only in the results). These fields could be hidden using a stylesheet or custom template, potentially after corralling them into a private fieldset.

The Webform UI does not allow the changing of component type. I see this information stored in webform_component.fieldset, so you could probably modify it there. You'd also want to update the component settings in the "extra" column.

1

Consider if you really need the data structure intact or not, or if you just need the data preserved. Are you using the webform data in a view? Is anyone dependent on the automated 'Analysis' that Webform provides?

If you only need to send confirmation emails for new submissions, then add the new field with the same labeling, a different key and the correct type, and then suppress the original field by marking it as 'Private' in the field settings.

Private fields are shown to users who have access to results, so this may not work for your use case.

Alternatively, use the Node Clone module to clone the webform and change that field without either losing data or having to re-key everything.

0

If the field you delete is unique to a content type, then the field is gone from the database (that includes it's data). If you delete a shared field from, the field is removed from that content type along with the data unique to the content type.

If you find that you need to keep the data associated with the field but you need a different type of field for the data, you need to plan ahead.

  • Create the new field.
  • Devise a way to migrate the data from the old field to the new field.
  • Delete the old field.

A good solution might be to use Feeds module (to import to fields) and Views Data Export Module (to export fields to the spreadsheet). The procedure would be:

Setup a view that lists all of your textfield values and displays all of the fields you want to migrate. Then data export and choose CSV format.

Use feeds to import the data to D7. Just map each exported field to your preferred field.

on the other hand you might want to read this tutorial too

  • Will Feeds import Webform data? – mpdonadio Jun 15 '13 at 23:03
  • Follow up to MPD: Are Webform components considered fields? Webform does not allow you to define your own component types except through custom modules so I would assume Webform components are all shared fields? – Kevin Morse Jun 15 '13 at 23:04
  • Kevin I'm not sure but I think yea, you could try it anyway, and in case feeds didnt work out you can try webform import drupal.org/project/webform_import – Sohail Jun 16 '13 at 16:39

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.