Last updated July 25, 2010. Created on May 9, 2010.
Edited by bekasu, Francewhoa. Log in to edit this page.

Objective

In this tutorial we will use rules module to redirect to a specific page when a user click on Save button to submit a form. This work with CCK forms and should work with any type of forms. This tutorial is for absolute beginners. If you consider yourself an advanced user find the README.txt file that comes with the module.

Requirements

  • Drupal 6.x
  • Rules module 6.x-1.2 or more recent.
  • Both Rules Forms support & Rules Administration UI Rules sub-modules must be activated at admin/build/modules.
  • We assume that the page you want to redirect to is already created.
  • We assume that your CCK content type is already created.

Optional

  • Token module if you want to use tokenized URL. Make sure that the Token sub-module Token actions is activated.

Steps

  1. Go to admin/rules/forms to configuring Form events.
  2. Check Enable event activation messages on forms feature. Click on Save settings button.
  3. Go to node/add.
  4. Click on the appropriate content type link.
  5. Close by the top of the next page search for a big yellow box. Click on ***********_node_form link.
  6. Where *********** is the name of your content type.

  7. On the next page click on Activate button.
  8. Go to admin/rules/trigger/add.
  9. To create a new rule fill the Label field. The label could be anything.
  10. Under Event select ************ node form is submitted option.
  11. Leave other options to their default setting.
  12. Click on Save changes button.
  13. On the next screen click on Add an action link.
  14. Under Select an action to add: select Set the redirect target of the form option.
  15. Click onNext button.
  16. On the next screen fill the To: first field. You must type in the URL of the page you want to redirect to. Without the http://www.domain-name.com/ For example in my case I type in page/section/confirmation. Leave ? and # fields empty unless you know what you're doing ;) If unsure find below screenshot.
  17. Click on Save button.
  18. That's it you have successful created a rule to redirect to a page when user submit a form.
  19. To test simply create an new node at node/add

Issue

This tutorial works except when a user tries to delete a node. After following this tutorial, if a user clicked "Delete" instead of getting a confirmation they would be redirected (and the node would not be deleted). "Preview" is not affected and still works.

AttachmentSize
to-field-cropped.png5.26 KB

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

cbear42’s picture

First, thanks so much for taking the time to document! It is an awesome thing. ;-)

I have a question on the form activation functionality. Presently I can choose ONE form to activate - attempts to create or activate other forms - results in a
"Events for node_type_form have already been activated. " message. I have several different forms that I need to re-direct to entirely different pages.

What am I missing? It seems that Rules used to have this (somewhat basic) functionality?

TIA.

Chana Campos
BrainTag
www.braintag.net

thalemn’s picture

When I try to add an Action, it just brings me back to the add an Action screen.

What does this mean?

I configured Rules for a different client and it worked great! Help!

Thank you for the excellent tutorial.

Tom
New Day Web Design
www.newdaywebdesign.com

Update - this was the problem!

ok here is the skinny on the rules module not accepting action field. This was a mofo to figure out. The mobile tools http://drupal.org/project/mobile_tools module and the rules module http://drupal.org/project/rules have a conflict.

I guess you can turn off the mobile module and create the action and then turn it back on. I kinda think this is a name collision but don't really know

Tom Hale
New Day Web Design
www.newdaywebdesign.com

iris_hbo’s picture

Any suggestions how to solve this issue?

itserich’s picture

This worked for me. The big yellow box in Step 5 must have been removed.

And yes, even for User 1 it does not delete, but I normally delete through content so does not matter to me.

Be careful to follow Step 3 by Adding a node, first time I did Step 3 I must have gone to Edit the content type and it has a similar form function so I did not realize the error immediately.

Thanks for a good intro lesson.

wfyanmnm’s picture

when I enter a external link, for example: http://www.google.com/test, it will be http://localhost/?q=test, I don't know how to solve it.