Life’s Lustre

Magic Code

Posted by: ipsita mishra on: November 6, 2007

I am sure , if you are developing a module in Drupal, then sometimes you might have needed to remove the ‘preview’ button from the new entry form. May be you want to remove the preview option for comment posts. Then here is a simply useful code.

In your module file add these lines of code,

function mymodulename_form_alter($form_id, &$form) {
// echo("form_id".$form_id); This line is just to check your form id.
if(($form_id=="mycontenttype_node_form")||($form_id=="comment_form")) {
unset ($form['preview']);
}
}

I got this help from http://drupal.org/node/138393

Leave a Reply

Blog Stats

  • 2,476 hits

 

November 2007
M T W T F S S
« Oct   Jan »
 1234
567891011
12131415161718
19202122232425
2627282930  

Follow Me

My Tweets