I created a node type module and write a form for it. Can I remove or just hide the default form part which are called 'Menu settings', 'Comment settings', 'Authoring information' and 'Publishing options'?

Comments

For most people they should not show.

Unless you give most people 'administer nodes' they should not see those sections of the edit form. User 1 will always see them and you want that to be true. At some point you will want to change that information for some post for some reason.

thanks

thanks~ :)

I add a button called 'back' in the form. But it is in middle of the default collapsed part. I mean that there are two collapsed fieldsets before the button and two after it. Althought I set the weight of it to 1000. the result is same.

why?

stay hungry, stay foolish

Can you post the code that alters the form

Can you post the code that alters the form, it could make it easier to help you find a solution.

the form

function topic_form(&$node) {

// add js
$path = drupal_get_path('module', 'topic');
drupal_add_js($path . '/js/topic.js');

$form = array();
$form['#pre_render'] = array('auction_form_pre_render');
$form['#attributes'] = array('enctype' => 'multipart/form-data');
$form['topic_id'] = array(
'#type' => 'hidden',
'#default_value' => $aid
);

/** Page 1 ***********************/
/*********************************/
$form['category_part'] = array(
'#type' => 'fieldset',
'#title' => 'select category',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => true
);

// category
$form['category_part']['category_selector_header'] = array(
'#value' => '

');

// get top categories
$categories = module_invoke('auction_category' , 'get_categories_list', 0, FALSE, FALSE, TRUE);

$form['category_part']['categoryid'] = array(
'#type' => 'hidden',
'#default_value' => $cid
);

// first/top selector
$form['category_part']['top_selector'] = array(
'#type' => 'select',
'#options' => $categories ,
'#default_value' => $cid,
'#attributes' => array('title' => 'o_cs', 'onchange' => 'category_select(this)'),
'#size' => 10,
'#required' => TRUE
);

$form['category_part']['category_selector_footer'] = array(
'#value' => '

');

// display cid
$form['category_part']['display_selected_cid'] = array(
'#type' => 'textfield',
'#title' => t('category number'),
'#default_value' => $cid,
'#required' => TRUE
);

/** Page 2 ***********************/
/*********************************/
$form['work_detail_part'] = array(
'#type' => 'fieldset',
'#title' => 'work details',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE
);

// title
$form['work_detail_part']['job_title'] = array(
'#type' => 'textfield',
'#title' => t('job title'),
'#default_value' => $job_name ,
'#size' => 30,
'#required' => TRUE
);

// subtitle
$form['work_detail_part']['job_subtitle'] = array(
'#type' => 'textfield',
'#title' => t('Subtitle'),
'#default_value' => $job_subtitle,
'#size' => 30,
'#description' => t('This will cost you ')
);

// job description
$form['work_detail_part']['job_desc'] = array(
'#type' => 'textarea',
'#title' => t('job description'),
'#default_value' => $job_desc,
'#description' => '' . t('we recommend you to use a template below') . ''
);

/** Page 2.1 ***********************/
// template part
$form['work_detail_part']['template_part'] = array(
'#type' => 'fieldset',
'#title' => 'use template',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => true
);

$form['work_detail_part']['template_part']['auction_template'] = array(
'#value' => 'no template'
);

// free image
$form['work_detail_part']['free_attached_image'] = array(
'#type' => 'file',
'#title' => t('FREE attached image')
);

/** Page 2.2 ***********************/
// non-free image part
$form['work_detail_part']['non_free_image_part'] = array(
'#type' => 'fieldset',
'#title' => t('add non-free images'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE
);

// 9 hidden values of non-free image
for ($i = 0; $i < 9; $i++) {
$form['work_detail_part']['non_free_image_part'][$i] = array(
'#type' => 'file',
'#default_values' => ''
);
}

// attachment_file
$form['work_detail_part']['attachment_file'] = array(
'#type' => 'file',
'#title' => t('attachment')
);

// work start date
$form['work_detail_part']['work_start_date'] = array(
'#type' => 'textfield',
'#title' => t('work start time'),
'#size' => 12,
'#default_value' => $work_start_time,
'#required' => TRUE
);

// work end date
$form['work_detail_part']['work_end_date'] = array(
'#type' => 'textfield',
'#title' => t('work end time'),
'#size' => 12,
'#default_value' => $work_end_time,
'#required' => TRUE
);

// location
$form['work_detail_part']['zipcode'] = array(
'#type' => 'textfield',
'#title' => t('location'),
'#maxlength' => 128,
'#default_value' => $location,
'#required' => TRUE
);

/** Page 3 ***********************/
/*********************************/
$form['auction_detail_part'] = array(
'#type' => 'fieldset',
'#title' => 'auction details',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => true
);

// auction duration
$form['auction_detail_part']['duration'] = array(
'#type' => 'textfield',
'#title' => t('Auction duration(days)'),
'#size' => 12,
'#default_value' => $work_end_time,
'#required' => TRUE
);

// auction start price
$form['auction_detail_part']['start_price'] = array(
'#type' => 'textfield',
'#title' => t('start price'),
'#size' => 12,
'#maxlength' => 12,
'#default_value' => $start_price,
'#required' => TRUE
);

// bid_increment_size
$form['auction_detail_part']['bid_increment_size'] = array(
'#type' => 'select',
'#title' => t('select bid step($)'),
'#options' => array(1 => '1', 5 => '5', 10 => '10', 50 => '50'),
'#default_value' => 1
);

// allow lower bid
$form['auction_detail_part']['allow_lower_bid'] = array(
'#type' => 'checkbox',
'#title' => t('I also allow bids above the lowest bid (but not above the start price)'),
'#description' => t('If selected, you allow bidders to make bids that are higher than the current lowest bid. People can then offer their services even if a very low bid has already been made.
Note: if selected, Bid increment size is deactivated.'),
'#default_value' => 0
);

/** Button ***********************/
/*********************************/
$form['back'] = array(
'#type' => 'button',
'#value' => t('Back'),
'#weight' => 100
);

return $form;
}

stay hungry, stay foolish

Found the "problem"

The placement of your button has to do with the way the node module builds the content forms. One of the steps they do is theme the form with theme_node_form() which places those elements you see after the 'back' button on the at the end regardless of the weight of other elements. To change this behaviour you can add the following function to your themes template.php file (if there is no existing template.php file create one and add the function)

function phptemplate_node_form($form) {
  $output = "\n<div class=\"node-form\">\n";
  if (isset($form['node_preview'])) {
    $output .= form_render($form['node_preview']);
  }

  // Everything else gets rendered here, and is displayed before the admin form
  // field and the submit buttons.
  $output .= "  <div class=\"standard\">\n";
  $output .= form_render($form);
  $output .= "  </div>\n";

  $output .= "</div>\n";

  return $output;
}

This will render the form has defined. Preview should work but I did not test that.
nobody click here