20002

Kohana redirect

Question:

After a form-submit in Kohana, I want the user to go back to the homepage. Is it correct to use a redirect for this?

public function action_edit($id) { if (!empty($post)) { if ($post->validate()) { $this->request->redirect(Route::get('admin')->uri(array('action' => 'list'))); } } }

Thanks in advance!

Answer1:

Sometimes $this->request->uri($params) (instead of Route::get()->uri()) maybe useful. For example, when you want to use current controller (redirect to another action) or the same route. It will use route params from current request by default.

Answer2:

The redirecting part is indeed correct. The validation part is missing a few lines.

Recommend

  • new Intent(Intent.ACTION_EDIT, ContactsContract.Profile.CONTENT_URI); is not working in Some of the
  • how to set cookie in kohana framework
  • Secure XSS cleaning function (updated regularly)
  • URL decoding not working as expected
  • iOS Validation failed -> Bundle is invalid (Xcode 6.2, iOS 8.2)
  • jQuery - how to validate a date of birth using jQuery Validation plugin?
  • Jackson Parser: ignore deserializing for type mismatch
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • Highlight one bar in a series in highcharts?
  • Lost migrations and Azure database is now out of sync
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Why is an OPTIONS request sent to the server?
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Dynamically accessing properties of knockoutjs observable array
  • script to move all files from one location to another location
  • WinForms: two way TextBox problem
  • Validaiting emails with Net.Mail MailAddress
  • Can I make an Android app that runs a web view in Chrome 39?
  • Symfony2: How to get request parameter
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • log4net write single file for each call to log.info
  • Free memory of cv::Mat loaded using FileStorage API
  • Getting error when using KSoap library to consume .NET web services
  • Memory offsets in inline assembly
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Binding checkboxes to object values in AngularJs
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?