• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yet another validation question

Oh, I see. Hmm, I haven't usually dealt with sending data to a different controller and keeping validation data. If I do send the data to another controller, I just load the view. If the URL submitted has all the segments you need, it should load the view with all the right validation information.

The problem with redirecting is it refreshes the browser and deletes all POST variables and validation data.

It sounds to me like the email methods should be in an 'email' model, so that you can use it in whatever controller you're in. Otherwise, you could put it in a library.

However, the other option is to use flashdata, which I've recently started using with the Native Session class and have found incredibly useful. You need to use the Native Session class in place of the default CodeIgniter one, but it's really easy to do.


Then you can:


//If validation fails:
$this->session->set_flashdata('errMessage', 'Validation failed error message');

And on the profile page, you can get the message with:
if ($this->session->flashdata('errMessage')) echo $this->session->flashdata('errMessage');

[eluser]Michael Wales[/eluser]
The Session library from the SVN now includes flash data (as well as ID regeneration).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.