1

I'm trying to make an auction website. Therefore I made 2 Custom Content Types:
1)Item for sale
2)Offer(Bid) from user(with node reference url to Sale item)
I need to receive only 1 field(Price) from the user while making a Bid (creating the second content type).

I deleted the 'Body' field from my Content Type but I could not find a way to remove 'Title' field because it is mandatory(required) field :(
The user that makes a Bid(offer) has nothing to do with Title (he doesnt need to know that he's creating a content)

How can I remove the 'Title' field?

2

You can use the Auto Nodetitles module.

"auto_nodetitle" is a small and efficient module that allows hiding of the content title field in the form. To prevent empty content title fields one can configure it to generate the title by a given pattern.

When the token module is installed it's possible to use various node data for the auto generated title - e.g. use the text of a CCK field (since 5.x).

1

You can use hook_form_alter:

function sample_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'article_node_form') {
    $form['title']['#required'] = FALSE;
  }
}

or

function sample_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'article_node_form') {
    unset($form['title']);
  }
}
  • 1
    The title field in the node table schema is not allowed to accept null values. If you follow this method, then even if it does work you'll be slowly messing up your database. – Chapabu Mar 19 '12 at 10:38
  • Auto Nodetitles will do the job, it seems. Afterall I'm not familiar with hook alters – wallace740 Mar 19 '12 at 10:53
  • Auto nodetitle worked perfect. Now I need to change the "Create" word as well. How can I change that Label(only for that specific content type)? i40.tinypic.com/bhlpu9.png – wallace740 Mar 19 '12 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.