Lots of times one webform is based on another. Sometimes only the target or an individual field might change.

Since it usually takes some time to configure a webform (esp if it has lots of fields), it would be great to be able to dup / clone it for reuse. Especially for sites that have multiple forms. And also so that you can use one form in multiple unrelated sites.

CCK has this now with it's copy feature. Views allows you to import export.

Any chance this will happen for webform?

Any way to manually do this (outlined manual procedure)?

thanks

Comments

quicksketch’s picture

Yes, you can do this already with the node_clone module: http://drupal.org/project/node_clone

newdru’s picture

have you actually tried that to confirm it works?

i ask because webform has about 4 extra tables specific just to it. just checking?

thanks

quicksketch’s picture

I tried it with 4.7 and it worked fine. Haven't yet tried 5. node_clone loads the entire node, then saves it with a new node id. It should work with any node type. Of course you should be cautious and try it locally or on a copy first, but I don't think there are any problems.

newdru’s picture

i'll give it a try tommorrow.. thanks!

newdru’s picture

just thought of one thing...

node clone only solves the problem of duping a form withIN a site (a single db).

If you want to reuse the form in a DIFFERENT site, you're out of luck.. any thoughts?

thanks

quicksketch’s picture

Yep, pretty much out of luck afaik.

You could try import/export module, which uses the same kind of method. But I'm not familiar with it's process.

quicksketch’s picture

Status: Active » Closed (won't fix)
deviantintegral’s picture

Version: » 6.x-2.x-dev
Status: Closed (won't fix) » Needs work
StatusFileSize
new4.21 KB
new4.24 KB

I needed to be able to do this as I was getting annoyed with having to re-create the same form on different sites. Here is a patch which allows users to export the current form and then import it back onto another site.

A few questions I ran into while doing this code:

  • Right now, you need to have the permission to use PHP, as it eval()'s the text on import. Is there some other, more secure way to do this?
  • Looking at webform_load(), it only adds items to $node->webform, though it doesn't need to be limited to that object. Currently the export code only exports the contents of ->webform; does it need to do more than that?
  • To import, currently you create a new webform node, and then use the import tab to import your settings. This was to fit the current workflow of "create the form, create components". Any thoughts as to allowing an import directly on node/add/webform?
  • I've created one menu tab for importing and exporting, as I wanted to try to limit the number of tabs. However, I'm open to them being separate tabs if there's a good case for it.

The D5 version is reasonably tested, while the D6 version is very lightly tested ATM.

quicksketch’s picture

Status: Needs work » Closed (fixed)

The node_export (http://drupal.org/project/node_export) module now works flawlessly with Webform, you should just use it instead. Please do not open issues that are over a few months old.

deviantintegral’s picture

Ooo pretty; never see that module before. Thanks!

sdk’s picture

The D6 patch didn't work for me. I get the following error:

warning: Invalid argument supplied for foreach() in XXX/includes/menu.inc on line 258.

I see the Import/Export tab. When i click on it the Webform Export field is empty and just says 'NULL'.

Any pointer what could be wrong?

deviantintegral’s picture

This feature is dead; use the module linked to in #9 instead.

sdk’s picture

The Node Clone module is for copying nodes within one installation but doesnt let you export/import them to a different install of drupal...

cdale’s picture

The module linked too in #9 is node_export (http://drupal.org/project/node_export), not node_clone (http://drupal.org/project/node_clone). Node export will do what you want.

mgifford’s picture

Not to re-open this, but there's also this module - http://drupal.org/project/webform_share