Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I have a block with node/add/page in it that is visible on numerous pages. When I use the form block to create the new page, the default drupal action is to display the new node. Instead, I'd like to simply refresh the page that contained the formblock. However, since the formblock is on numerous pages, I can't set a hard-coded
$form_state['redirect'] = 'some-page';
option in function MYMODULE_submit
any suggestions would be welcomed.
Thanks,
Dean
Comments
Comment #1
Courtney.B CreditAttribution: Courtney.B commentedYou could potentially use Rules in conjunction with Rules Support Forms to achieve what you're talking about.
Comment #2
visuaLatte CreditAttribution: visuaLatte commentedYou could use Rules, probably even without the Rules Support Forms module. A rule could potentially be set up like this:
Event: creating a new node
Condition: Content is of type [...]
Action: Page redirect to /node/[nid]
Comment #3
praveenneelu CreditAttribution: praveenneelu as a volunteer commentedYour use case is "Redirect users to a different page upon viewing or submitting a form." It is available as a Feature of Rules Forms Support module in Drupal 7 to generate the action when events get triggered.