fixed comment subject

bdtushar - September 28, 2009 - 18:25

Hello
I want that comment subject field to fixed as list item for specific content type.

Say there is a content type content type 01 and there will be listed comment subject as

1. option 01
2. option 02
3. option 03

So when user want to comment on content type 01 he must select comment subject from list.

Is it possible?

Yes, that's possible. You

marcvangend - September 28, 2009 - 20:26

Yes, that's possible. You need to create a small custom module and implement hook_form_alter. Inside that implementation, you check for the correct form_id (I guess it's 'comment_form') and node type using an if-statement, so it only runs when you want it to. Inside that if statement, you start altering the $form array. Change the '#type' value of the subject field to 'select', build an array with the options and assign that array to the '#options' value. See http://api.drupal.org/api/function/hook_form_alter/6, http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.... and http://www.drupaldojo.com/minilesson/hook-form-alter-breakdown for more info.

thank u

bdtushar - September 29, 2009 - 00:44

thank u for ur important help.

I tried but failed

bdtushar - October 11, 2009 - 12:19

I tried. But did not understand. I cant make module. Please help me in detail.

To learn about creating

marcvangend - October 11, 2009 - 21:02

To learn about creating modules, read http://drupal.org/node/206753. You can also take the shortcut by installing the 'Module Builder' module (http://drupal.org/project/module_builder) which will create the outlines of a custom module for you.

thanks

bdtushar - October 15, 2009 - 00:43

I will try. Hope this will help me

 
 

Drupal is a registered trademark of Dries Buytaert.