[rant]The forced preview on everything that is posted to drupal.org is making me a nutcase. Sometimes I don't even bother to post or forget to continue a post if I am busy. If I am answering a question quickly that person will not get my post because it is still sitting in preview while I go on to something else. I then close the browser window and the post and though are lost.

Many times I see the preview and press preview again thinking that I am submitting. Then I go back later and find no post. Again the person I am responding to suffers bcause I can't remember what it was I was going to say.[/rant]

Now I am going to boil something like coffee or an egg >:)

Comments

I have a module in progress where I'll just have to ignore Preview until I can find a civilised and humane way to kill it (for certain modules).

If you find a way then please let me know. I have been trying to remove preview from node editing without any luck. I don't think the validation routine should send you to preview when an error is encountered and only give you a choice of previewing again before submitting. It's just crazy.

When you are setting up drupal on the content-settings page (admin/node/configure) you can chose to have preview as optional and you can submit the post directly. Does this solve your problem?

gpdinoz
"If we can see further it is because we stand on the shoulders of giants"

Regards
Geoff

I think that would solve the problem, but I don't see such a setting for page or story, which is what a lot of young, homegrown modules are based on. If you know of an example, that would be cool.

May be I haven't understood your problem, but if you are talking about node editing on your own sites, can't this be set right by making Preview optional at administer>>content>configure?

On page and story for example, there is no such facility at administer->settings->content types->[page|story]->configure. If some other module has an example of it, please point me to it.

In Drupal 4.7 you can find this at administer » settings » posts (admin/settings/node).
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

No, not where you mention.

Or try this:
www.yourdomain.com/admin/node/configure

Replace yourdomain.com with your domain name. If your drupal install is in a sub directory, then put that also in the path above.

This is a global setting and is not available per content type in 4.6.

When you set it to optional it does not include if there is a error in validation. When an error happens you get both a form AND a preview which is even worse because in most themes this particular screen presents broken HTML.

My original complaint is this is not set as optional on Drupal.org which would help usability here. But on my own sites I don't want to see this at all.

In misc. sites, it would be useful to be able to force preview for certain input filters, however. But especially for comments here on Drupal.org, I doubt if it is more useful than annoying. Almost aIl posts are in plain text, so what's the point?

There is of course not one solution that fits all, but that is why the most common situation should guide the choice.

I have also lost some posts due to this, mostly because I use many tabs in Firefox and quickly move on to a different one before checking the result. When I eventually come back to that tab, often hours later, I notice it and finally submit.
- But not when Firefox crashes meanwhile...

(- which happens more and more now that we keep adding extensions and web sites start using AJAX features. For example, I had to remove the nice Yahoo email inline preview extension as it crashed Firefox.)

The latter is not really "off-topic", as this is the situation many of us have now.

I think any good post on Drupal.org is worth more than the actual consequences of "risks" by not enforcing preview on comments.

[FYI: Feb. 2012: User name changed from "DanielTheViking" to "Leeteq".]

have thought I've submitted posts, only to come back a day or two later to have found I must have just "preivewed" the post & forgotten to submit it. It is not an intuitive system.

Forced preview is an annoyance in all cases where you have the opportunity to edit your post or comment after publishing it.

On Drupal.org you have to be registered in order to post anything, and you can edit your comments, at least for a while.

I wonder why it is that we are not allowed to edit the first post in a thread ? If we are registered users, we should be trusted enough to edit our typos in our posts ?

Also, we should be able to edit our "issues" posts. Can someone explain to me the actual reasons why we cannot ?

Caroline
11 heavens.com

As stated by nathandigriz, none of the suggestions above actually touches the problem. For now, this gives me what I need. I've added a setting to the module:

function culture_settings() {
  $form['culture_disable_preview'] = array(
    '#type' => 'radios',
    '#title' => t('Preview'),
    '#default_value' => variable_get('culture_disable_preview', 0),
    '#options' => array(t('Enable'), t('Disable')),
    '#description' => t('Enable/Disable Preview on posts?')
  );
  return $form;
}

and a hack to node.module:
--- drupal-cvs-20060228/modules/node.module
+++ drupal.dev//modules/node.module@ -1686,7 +1686,9
@@
   }
   // Add the buttons.
+  if( ! variable_get( $node->type . '_disable_preview', 0)) {
   $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40);
+  }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 45);
   if ($node->nid && node_access('delete', $node)) {
     $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);

I went caveman also and just gutted the node_preview because it was causing too many problems with the css based themes.

http://drupal.org/node/51835

This is a result of an attempt to include this functionality in core. Unfortunately, it has been marked today as "won't fix", hence the contrib module. ;-)

Doubt is the beginning, not the end of wisdom.

If it is very simple, will there be a version for 4.6.x too? There is a lot of sites that will stick with that version for quite a while. Thanks for the contribution :-)

[FYI: Feb. 2012: User name changed from "DanielTheViking" to "Leeteq".]

It's based on the formsapi implemented in 4.7

I believe such a thing is not possible in 4.6, without hacking the core.

Doubt is the beginning, not the end of wisdom.

http://drupal.org/node/51835 not found? What is the name of the module (or, does someone have a link to the new location?)

Michael Curry - Exodus Development

seems that this problem still remains! it's drive me crazy because all of our site members keep telling me to remove this preview button.

sina.salek.ws, Software Manager & Lead developer
Feel freedom with open source softwares

Another solution is to create a simple module containing the following (that's what I do):

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

This code suppress every previews in drupal.

An improvement is to filter according to the content type (easy to do, and no need to update the core)

function mynewmodule_form_alter($form_id, &$form)
{
$form['preview']['#type']='hidden';
}

You will also have to change the Admin->Content Management->Post settings to 'Preview post optional', otherwise you will have no post button on the initial creation page.

Preview can be made optional on both posting and commenting forms in 5.0 RC1.

To make it optional for posting a blog, page, story or topic just go to :

Administer | Content Management | Post Settings

Then choose Post Preview : Optional

To make it optional for creating a comment just go to :

Administer | Content Management | Comments -> Settings Tab

Down in the Posting settings section you can choose Preview Comment : Optional

On a side note this (www.bikekentucky.com) is my first experience with using Drupal. So far so good. In some cases its been confusing but as I get more into it I've been able to find options for making it do what I want by methodically going through the admin screens. I've got years of programming experience and I intend to customize the site a lot but for now will keep it simple since I'm using 5.0 and don't want to tweak things to much and have to break them as updates come out.

The above code removes the preview button completely. When you choose 'optional' a submit or post button is added to the page, but the preview button still remains.

Thanks Scott, I used your method and it works!

A much simpler method:

In your theme.css file:

#edit-preview{
display:none;
}

No code hacking and if you want this to only be hidden on certain forms, you can denote by:

.myformclass #edit-preview{
display:none;
}

Slick, eh?

a user is visiting a site with his mobile-i-have-no-css browser? He see's the preview button. When CSS on browser is disabled, the button is seen.

As far as I remember I removed it by making a simple own module like in previous comments someone suggested, but in the hook_form_alter I put unset($form['preview']) to completely get rid of the preview button.

in drupal 6.2 that is installed whether I select optional OR required for preview comments there is always the preview button, .i.e. I will always have peview button.So if I unset preview I can't preview or save.Can someone help me out??

So if I unset preview I can't preview or save.Can someone help me out?

If you don't make Preview mandatory _and_ you unset it from within a module (or theme, actually), then you can certainly save your comment or node.

Caroline
11 heavens.com

Caroline
11 heavens.com

This worked for me, for now. :)

Thanks.

Nice one, thx Nimzie... works for me for now. Actually trying the Bypass module also listed here, but so far haven't got it to work, so this CSS alt seems to work well.

hhhhmmm, on 2nd thought (having a lot of those these days), I just did a test post where this CSS mod above did remove the Preview button on initial creation but did NOT remove it on subsequent edits; e.g., when I first submitted the node, preview wasn't there (good), but when i re-edited the node, preview was there (bad).

Any idea how to also remove Preview button from re-edits?

(subscribe)

Doubt is the beginning, not the end of wisdom.