I want to embed a webform into a product form which is contrary to what uc_webform does. Reason is: I want to enhance product forms by form elements which is far away from what Ubercart attributes are allowing. Webform seems to be a good way to create such form elements. Now I only want to have the webform appended to the product form part and not to the product node itself using its own Submit button. Anyone have a hint how to do this?

CommentFileSizeAuthor
#3 uc_embed_webform.zip4.11 KBfuerst

Comments

fuerst’s picture

Status: Active » Closed (fixed)

By answering my own question: Got it working by creating a custom module:

  • Using hook_form_alter() to embed a webform to the Add to Cart form of a Ubercart product node.
  • Using hook_nodeapi() the webform components are removed when viewing the node. That way the webform will not be rendered again by its usual way.
  • Using hook_add_to_cart_data() to append the submitted webform data to the cart item.
  • Using hook_order() to show the webform data in the order (email, order admin page)

There is no Webform submission generated because I do not want redundant data. Webform module is therefor reduced to something like a form builder. May be the Form Builder module is a better way than using Webform for this purpose.

aminalid’s picture

Hi fuerst...
I am trying to load a webform into a drupal form and submit both in one action, the idea is to have the webform embedded as a feedback form into another modules action form.

Is there a chance that you can share the module or provide some code snippets for the form_alter and nodeapi hooks.

Thanks.

fuerst’s picture

StatusFileSize
new4.11 KB

Sure, the attached module should get you started. It is somewhat tied to the Ubercart module.