Let modify the node even when previewing it

Antinoo - October 7, 2008 - 00:08
Project:Drupal
Version:6.4
Component:node system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

What if one wants to automatically strip tags from the node title submitted by the users, when they click on 'Preview'?

In hook_nodeapi(), 'presave' can modify the title just before the node is going to be submitted, but not when the node is going to be previewed.

I know it's considered bad style modifying the data when validating.
But I'd like to automatically modify the node title even when previewing the node itself.
I don't want users have to modify it manually (IOW, I don't want to use form_set_error()).

I think I could also do it using hook_nodeapi() when $op is 'view' (and 'alter'), but this means my code will be ran each time a node is viewed, and that's not good: I'd like to run it only when the user is going to preview/insert/update the node.

I really think it should be inserted something like a $op == 'preview' action to hook_nodeapi():

Am I wrong?

Greetings, Giovanni

#1

Antinoo - October 11, 2008 - 17:35

Any thought about this?

 
 

Drupal is a registered trademark of Dries Buytaert.