Hey, folks. The site I'm working on right now is designed to emulate an FTP browser, and I'm using Flexinode (hail Flexinode!) to create the file nodes. When you click preview on a file upload, it doesn't upload anything, and it wipes the information in the fields (!).

I understand the reasoning behind why it does that, but given that this site is designed to be as stripped-down and user-friendly as possible, I'd rather not have this functionality to confuse my tech-noob users.

I got this handy module from a chap on the irc support channel which removes the preview button.

function killpreview_form_alter($form_id, &$form) {
  unset($form['preview']);
}

BUT this only removes the button, not the ability to preview, so whenever a user hits 'Enter' from the submit form, it performs the preview function anyway.

And wipes the fields, confusing the user.

Do I have no choice but to harass the core modules if I want to change what the key press 'enter' triggers? How should I go about that?

Comments

gjost’s picture

If you follow this advice, remember to restrict the unsetting to the specific form(s) you want to affect. Otherwise, you will turn off the Preview button for ALL forms, including Pages, Stories, and Comments.

<?php
function killpreview_form_alter($form_id, &$form) {
  if ($form_id == 'killpreview_node_form') {
    unset($form['preview']);
  }
}
?>