Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
contact.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2010 at 10:46 UTC
Updated:
2 May 2018 at 10:33 UTC
Jump to comment: Most recent
Comments
Comment #1
wavesailor commentedping
Comment #2
MadTogger commentedHi,
I was searching for how to do this also and found nothing but I have eventually sorted it out myself.
Open up the Contact Module and look for the file called, contact.pages.inc.
Around about line 54 you will see:-
I just commented it out like this:-
So far it is working fine on my site, see it at; www.madtogger.co.uk/contact
Whether this is the correct way of doing it I have no idea but it works.
The reason I just commented it out was incase for some reason it stopped working I could clear the comments.
Hope this helps.
Regards..,
MT
Comment #3
gpk commentedThe Drupal way would be to implement hook_form_alter() in a tiny custom module and then set
$form['subject']['#required'] = FALSE, orunset($form['subject']);to get rid of the field completely.Alternatively try webform module which lets you create completely customized forms for whatever purpose you want.
Comment #4
dave reidDon't unset. Please use the #access attribute to 'remove' things properly.
Comment #7
therobyouknow commentedanother approach would be to use CSS class with display: none property in a DIV around the field.
Comment #8
andread commentedFor Drupal 7 it is slighlty different:
function [Your_module_name]_form_contact_site_form_alter(&$form, $form_state) {
$form['subject']['#access'] = FALSE;
}
The function name have changed.
If you use #access then the field is remove totally, if you use #required than the field is visiable, but not required. ;)
Hope it helps someone in the future!
Comment #9
waqarit commented#8 worked for me.
Comment #10
hongpong commentedDrupal 8 technique as follows:
dump the $form_id if it's not known.
Comment #11
sébastien-fr#8 worked for me.