Hi,
I'm very confused. In Drupal5 I used to hide the menu-selection from user and set pid hardcoded
and title was taken from submitted content. I did this with this in my module:

D5

function omootk_nodeformstripper_form_alter(&$form, $form_state, $form_id) 
{
$form['menu']['#type'] = "value";
$form['menu']['title']['#value'] = $form['#post']['title'];
$form['menu']['pid']['#value'] = 159;
}

This works always great in Drupal5.

Now I changed over to Drupal6, adapted my code and mentioned that this isn't workung because
the title from post won't get overtaken-

D6

function omootk_nodeformstripper_form_alter($form_id, &$form)
{
$form['menu']['#type'] = "value";
$form['menu']['link_title']['#value'] =$form['#post']['title'];
$form['menu']['parent']['#value'] ="primary-links:0";
}

After reading in API I get noticed that this solution (hook_form_alter) shouldn't work - either with
Drupal5 because hook_form_alter is only hooked before displaying/rendering the form.

Strange :/

I can't figure it out :(

Why was this solution with Drupal5 in history?

My next approach is to find out how to solve it regulary.

thx for help!
melchior

Comments

melchior’s picture

hey,

I got it work!

Just use

$form['#submit'][] = 'manipulateSubmittedData';

in your hook_form_alter function

and supply this function

function manipulateSubmittedData (&$form, &$form_state) {
	$form_state['values']['menu']['link_title'] =$form['#post']['title'];
	$form_state['values']['menu']['parent'] ="primary-links:0";
}

regards,
melchior