views:

18

answers:

2

hi,

can I remove the "Choose forum dropdown field" from my forum nodes content types ?

I have only 1 forum and there is only 1 choice I would like my users not have to select it as additional step.

If there is not any option to remove it I would like to know how I can submit the form with that value.

I've tried to hide it: $form['taxonomy']['#type'] = 'hidden';

But it doesn't work because it is required, and I need to specify it if I want the new post added to the forum... I actually need to submit a default value if I want to hide it.

thanks

A: 

Use hook_form_alter and supply a hardcoded value and default value (what the value would be if they picked it), set #required to no. That should work.

http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6

Kevin
yeah I'm using hook_form_alter, I know how to set required to no, but I don't know how to exactly hardcode it. thanks
Patrick
$form['element']['#default_value'] = 'term'; $form['element']['#value'] = 'term'; something like that. Or, it might want a TID. Inspect your form to be sure. The option values in the drop down will be your answer.
Kevin
+1  A: 

Set #required to FALSE, #type to 'value', and #value to the value you find in #default_value. Doing so, the user will not see any selector, but the form submission handler will get a value.

kiamlaluno

related questions