I am trying to build a block which has the following features

  • This creates a node of specific content type.
  • The form shall contain the Title field and submit button only
  • Upon submission, the page is redirected to the full node edit page(of the content type), with the title content. If not possible a node to be created from the previous step
  • Successful node creation

My Drupal version 6.13. I have tried webforms, but could not make it the way I want.

I have searched the forms for about three days without any fruitful results or leads.

Can some on share some light?

-Binoy

Comments

binoykl’s picture

I was able to produce a form with text fields like Title and description. The submission is not being accepted as there is no vocabulary items, which is mandated for that content type.

How do I get the results of the following query into the form?

function taxonomy_get_term($tid) {
  static $terms = array();

  if (!isset($terms[$tid])) {
    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = 7', $tid));
  }

  return $terms[$tid];
}

The form

 function blurb_blurbform_submit($form, &$form_state) {
  if ($form_state['values']['blurb']) {
    global $user;
    module_load_include('inc', 'node', 'node.pages');
    $node = array('type' => 'questions');
    $blurb_form_state = array();
    $blurb_form_state['values']['name'] = $user->name;
    $blurb_form_state['values']['title'] = $form_state['values']['title'];
    $blurb_form_state['values']['op'] = t('Save');
    drupal_execute('questions_node_form', $blurb_form_state, (object)$node);
  }
}

I got the leads from http://drupal.org/node/526844. Thanks roopletheme

My PHP knowledge is really limited:(