CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Ways to Redirect
Pages: [1]

Author Topic: Ways to Redirect  (Read 293 times)

phanhan

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 234
  • CMS version: joomla
  • MySQL version: 3.4
  • PHP version: 2.34
Ways to Redirect
November 23, 2014, 02:03:04 am
Hey all,

I have a custom form in my extension and I want to redirect to a certain page after a form has been processed. How do I do this?
I have the post process function in my form. Should I do the redirect here? But then I miss the postProcess hook of this form. Is that correct?

Thanks,
« Last Edit: October 21, 2015, 07:58:46 am by mathieu »

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Ways to Redirect
November 23, 2014, 06:10:21 am
Correct - you should not issue a redirect directly from your form logic. Doing so would scramble the MVC separation of concerns. Instead, just tell the controller where it should go after your form is done.
In your postProcess function, use CRM_Core_Session::pushUserContext
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Ways to Redirect

This forum was archived on 2017-11-26.