Hello,

I love the Form Multicrud module, here it is:
http://drupal.org/project/multicrud

I wanted to store this as a CCK field with my content type and collect data from users with it. It is a perfect solution for prompting and showing Tabular data.

For Computed Code:
(given your form element name is multicrud

$node_field[0]['value'] = serialize($node->multicrud);

In Display field

$rows = unserialize($node_field_item['value']);
$header = array(mycolumn1,mycolumn2,mycolumn3,mycolumn4);
$display = theme_table($header,$rows["items"]);

In your hook_form_alter (so that you display the form on node edit page:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == "story_node_form")
  	{
	$stored_multicrud = unserialize($form['#node']->field_my_computed_field_name['0']['value']);
	//drupal_set_message(dpr(,true));

	$form['multicrud'] = array(
	'#title' => 'Accounts',
    '#type' => 'multicrud',
	'#weight' => 100,
    '#multicrud_elements' => array(
      // overwrite these!
	   'mycolumn1' => array(
        '#title' => 'Mycolumn1',
        '#type' => 'textfield',
        '#size' => 30,
      ),
      'mycolumn2' => array(
        '#title' => 'Mycolumn2',
        '#type' => 'textfield',
        '#size' => 30,
      ),
      'mycolumn3' => array(
        '#title' => 'Mycolumn3',
        '#type' => 'textfield',
        '#size' => 30,
      ),
      'mycolumn4' => array(
        '#title' => 'Mycolumn4',
        '#type' => 'textfield',
        '#size' => 30,
      ),
    ),
    '#default_value' => $stored_multicrud["items"]
 	);
}
}

Comments

OFF’s picture

Need more info

donquixote’s picture

Please notice that multicrud is alpha1, and what works with this module now might not work in the future.

My local version already looks quite different from what you can download in the module page.

OFF’s picture

I do not understand how to add multicrud form for node add page..

Show a step by step, how do I make a form multicrud added as in this example..

donquixote’s picture

Have a look at the documentation for hook_form_alter(), and then have a look how other modules use this hook to modify the node edit form.

OFF’s picture

I have worked with hook_form_alter, but on the instructions I did not succeed to bring the form add multitcrud

I feel that the solution is somewhere nearby, but I can not decide .. Maybe I am not alone .. It would be nice if you're a little supplement instruction more accurate indication of how to display the multicrud form on the node add/edit page

giorgio79’s picture

You need to change the form id to match that of your content type :)

You can use the devel module to get the name of the form the node add page.