0

I have a view that had a list of equipment. Each equipment node in the view needs a form so I can upload equipment drawings. I would like the form to belong to the node because it makes it easier for submission to understand it's context. Is there any way to do this?

I have webforms installed and I can create a webform for each node individually, but for some reason I can't find a way to add a webform for the content type.

Thanks!

2 Answers 2

0

If you are ok with custom code.

  • The form does not need to be inline to Content Type.
  • Consider this example
  • You have custom form. form builder of which takes an argument as nid.

    function custom_form_builder($form, &$form_state, $nid) { $form['nid'] = array( '#type' => 'hidden', '#value' => $nid, ); // form field goes here. }

  • Now in your view add nid field along with other fields you need and an extra custom field.

  • In your views you can define custom template for custom field.

  • Implement template_preprocess_views_view() to call drupal_get_form('form_id',$nid) and make it available on the custom template.

  • Print the form on the template.

  • Now when the custom form gets submit you can get the nid to update in $form_state['values']['nid'].

0

Each webform is a node, so you can use a node reference field on your equipment nodes and render that within your View.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.