I would like create a webform and add to content type. so when user create node, webform automatially add to node (webform is same for per node of content type).
is this feasible with webform 3?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
You can do it by node reference. Add those kind of field to your content type. You can always set default value for automatic add webform to node, but it doesn't add you form automatically to node edit form.
I test it by using node reference and views, but it doesn't display a webform on node edit page (in the same form).
You can try to use hook_from_alter, which means to add programatically fields from reference webform. IMO is the only solution or maybe there are some modules for this, but I didn't look for them.
You need add your submit function to this form too, because you need to filter and save webform fields programatically too. Check WebForm API for this. A lot of work, maybe you should think about better solution without programming and using webform at all?
I just came across this when searching for a similar thing. There are of course many ways to achieve this, and it also depends a little bit what is actually desired for a given use case. With this I mean whether a new webform should be attached to each node, or if the same webform should be shown on each of the node pages.
If you want to actually attach a new webform to each of the nodes, then you can enable webforms on that content type (from Configuration > Webform settings). This allows to create a form per node on that content type, but it does not create the form for each node automatically, it has to be created per node. This is not really useful if you want the same form for each node, but if you want the form to be created automatically, then there are a few modules to help with that: https://drupal.org/project/webform_template and https://drupal.org/project/webform_default_fields
The other approach is to create one webform and show that form on each of the node pages. This can be achieved by showing the webform as a block and specifying the block to display in the Content region and only on certain content type. First enable using a webform as a block by editing an existing webform node, click to Webform tab, click Form settings, open Advanced settings and check the Available as block checkbox. After that you can add the block from Blocks page normally and restrict visibility to a certain content type for example. If you need access to some values from the node where the form is displayed in the webform, you can add them as hidden fields and create a custom module that gets them from the node and sets the values to the form. Here is some discussion and examples about this: https://drupal.org/node/1470748