6

I'm using Drupal 7 and created a content type 'NewArticle' with the fields 'Title', 'Text' and 'Image'. Users have the permission to create a 'NewArticle', but I don't like the way of displaying the administration bar in order to let them create a 'NewArticle'.

Instead, I'd like to work with Webforms. My goal is to create a Webform with exactly the same fields as the content type 'NewArticle'. So what I want is: when users filled in the form and submit it, a new node 'NewArticle' is created with the submitted information.

How can I do this? Are there modules that make this possible? I can't find any...

  • 3
    you can always turn off the admin bar for specific roles. i dont believe there is a module that duplicates a webform submission into a node. – Patoshi パトシ Jul 22 '13 at 22:11
  • 1
    duckx is correct. just don't give the user "use admin menu" or "toolbar" permissions (depending on which one you are using). Hacking something out of webform to create a node is adding an unnecessary layer. Let them create the node directly. – Nigel Waters Jul 23 '13 at 2:13
  • @NigelWaters: I know how to disable the Administration bar, but what do you mean with "Let them create the node directly."? How can users do this without using the Administration bar? – Jeroen Jul 23 '13 at 20:19
  • 1
    This question is too old, but for the future comers, I'd suggest you rethink of your plan. There is a fine line to differentiate webform and nodes. They are for completey different purposes. Just improve the node form instead of trying to create a node out of webform a. – AyeshK May 31 '14 at 6:00
7

Instead of using the Webforms module to create new nodes, it's better to let the users create them directly at MY-SITE/node/add/CONTENT-TYPE. Trying to hack data out of a Webform only makes things unnecessarily more complicated. Hide the toolbar for other users and give them permission to add new content. Lastly, adapt the node form to your needs with a template file and style it with CSS.

3

Webform Default Fields With this module you can easily create much of nodes with same webform fields. It can be applicable in case of job vacancies with reply form, kind of quality feedback control or whatever your mind suggests you.

Because you can create more than one webform-enabled content types, you respectively can attach different default fields for each of them.

(or)

Webform report module create a new node on each webform submit. You can retrieve the data using views, customize it to your requirement.

This module allows users to create simple, dynamic reports based on data collected by the webform module. It adds a new node type that contains the report criteria, and the data displayed is updated automatically as webforms are submitted. The data can be sorted according to the viewer's preference without altering the report criteria.

  • I'm experimenting with the Webform Default Fields module, but I don't really understand how it works (sorry, I'm relatively new to Drupal) and I don't find a lot of documentation on the internet. Suppose that I've got the content type 'NewArticle' as mentioned in my question and that I've created a Webform with the same field as 'NewArticle'. What should I do next? – Jeroen Jul 23 '13 at 20:38
  • @Jeroen I'm with you; how the heck do you use this module?! Have you found any documentation or tutorials or... anything? – Sam Sep 18 '13 at 2:35
  • The Webform Default Fields module does not do what the question asks: "create a node with submissions of a webform". It creates default fields for new webforms. Bummer... I was hoping this was the right answer! – Sam Sep 19 '13 at 12:26
  • @Sam Unclear what you are asking, does this module helped you or not ? – Bala Sep 19 '13 at 12:37
  • @Bala No, the module was not helpful. It isn't relevant to the question. Jeroen's questions is (paraphrased) "how to make a node from a webform submission?". This module simply let's you assign default fields for new webforms. – Sam Sep 19 '13 at 16:39
0

Sorry i couldn't comment as I just joined.

But in addition to Jeroen's answer, this works quite well, until you want to track submissions and get detailed reporting, which is something that webforms does quite well!

but if you are wanting to use this method, may I also suggest Advanced Form Block which allows you to also put the node add form into a block and just insert that on one page and this negates the need to link directly to a node add form and it also allows you to keep all your site styling :)

If anyone can please figure this out please step up!

0

You may also migrate nodes to webform submissions using the Migrate Node-to-Webform module. Here is a quote about it (from the module's project page):

Migrates nodes (Drupal 6) to webform submissions (Drupal 7). e.g. Retrieves all nodes of type 'article' and fills up a webform by creating one submission for each node.

  • Welcome to Drupal Answers! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – kiamlaluno May 31 '14 at 5:22
0

Are there modules that make this possible?

Yes there is: you can use the Rules module for this. As an example, consider this rule (in Rules export format), which does what you're asking for:

{ "rules_create_a_node_from_webform_data" : {
    "LABEL" : "Create a node from webform data",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "webform_rules", "rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : [ "form_id" ],
          "selected_webform" : { "value" : { "webform-client-form-191" : "webform-client-form-191" } }
        }
      }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "The webform submitted contains these fields:\r\n\u003C\/ul\u003E\r\n\u003Cli\u003Ethe field labeled \u0022[data:demoform_title-title]\u0022 which has value \u0022[data:demoform_title-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_text-title]\u0022 which has value \u0022[data:demoform_text-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_number-title]\u0022 which has value \u0022[data:demoform_number-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_option-title]\u0022 which has value \u0022[data:demoform_option-value-raw]\u0022.\u003C\/li\u003E\r\n\u003C\/ul\u003E" } },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_text-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_text" : "Form variable text" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_number-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_number_text" : "Form variable number text" } }
        }
      },
      { "data_convert" : {
          "USING" : { "type" : "integer", "value" : [ "var-demoform-number-text" ] },
          "PROVIDE" : { "conversion_result" : { "var_demoformvar_number" : "Form variable number" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_option-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_option" : " Form variable option" } }
        }
      },
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "article",
            "param_title" : "[data:demoform_title-value-raw]",
            "param_author" : [ "user" ]
          },
          "PROVIDE" : { "entity_created" : { "article_created" : "Created article" } }
        }
      },
      { "data_set" : {
          "data" : [ "article-created:body:value" ],
          "value" : [ "var-demoform-text" ]
        }
      },
      { "data_set" : {
          "data" : [ "article-created:field-free-format-nr" ],
          "value" : [ "var-demoformvar-number" ]
        }
      },
      { "data_set" : {
          "data" : [ "article-created:field-optionlist" ],
          "value" : [ "var-demoform-option" ]
        }
      },
      { "data_set" : { "data" : [ "article-created:comment" ], "value" : "0" } },
      { "entity_save" : { "data" : [ "article-created" ], "immediate" : "1" } },
      { "drupal_message" : { "message" : "A new article got created, with nid=[article-created:nid] and url=[article-created:url]" } }
    ]
  }
}

Anybody a bit familiar with Rules and Webform, while know that it's often a struggle to get access to the data contained in a submitted Webform. Mostly because they are not available to select them when building Rules Actions.

However by introducing those var-demoformvar-... variables (as in the above rule), you can make the typical Rules magic happen. Refer to my answer to "How to create a node from a Webform using rules?" for more details about all this.

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.