When editing some fields, after I click the save button, I want the page to redirect to a particular page. Is there any module for this requirement?
3 Answers
check the module Node save redirect
This module provides a method of specifying a location to take the user after saving a piece of content. A set of radios buttons are added to the submission vertical tab on the content type edit form. The available options are. Default - Default behaviour Return to Edit page after saving Return to content overview page (assuming the user has access permissions Re-redirect to another location. (any valid drupal path)
Another approach is to simply implement hook_form_alter and put this code into it:
function MY_THEME_OR_MODULE_form_alter(&$form, &$form_state, $form_id) {
// dpm($form_id)
// dpm($form)
if($form_id == 'article_node_form') {
$form['actions']['submit']['#submit'][] = 'my_node_form_submit';
}
}
function my_node_form_submit($form, &$form_state) {
$form_state['redirect'] = 'MY_URL';
}
You can use rules. Go to admin/config/workflow/rules. Add a new rule
-
react on event = saving new content.
Specify the content type this rule will work on.
Add an action to the rule -
in this case redirect page (under system - page redirect) -
and then add in the url of the redirect or use tokens. Plus rules has the added benefit of being useful for other things than just redirects.