Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: Change Redirect When A Form Is Saved

Submitted by on September 16, 2010 – 2:43 amNo Comment

When a form is saved, a user is navigated to a view page of the last saved node (‘View’ tab). It is necessary to make redirect to some URL.

You need to create a module and add the following code to MODULENAME.module file:

function MODULENAME_form_alter(&$form, &$form_state, $form_id) {
if (‘page’ == $form[‘#node’]->type){
$form[‘#redirect’] = ‘thanks_page';
}
}

This code works before editing form is shown in user’s browser and a standard redirect will be changed in this form. Please keep in mind that this is for page nodes only. However, you can use other conditions.

If you need to use special symbols in a path, please use construction like this:

function MODULENAME_form_alter(&$form, &$form_state, $form_id) {
if (‘page’ == $form[‘#node’]->type){
$form[‘#redirect’] = array(‘flex’, ‘component=pbrowser’, ‘t=1′);
}
}

Otherwise Drupal will change spacial symbols (?, & etc.) to secure symbols.

Useful links:
Redirecting with query string

Used materials:

drupal form redirection

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.