Calling a controller after validation error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Calling a controller after validation error (/showthread.php?tid=6409) |
Calling a controller after validation error - El Forum - 02-25-2008 [eluser]palaniappanc[/eluser] I generate my pages by calling multiple views (header, form, footer). How would I get this page back after validation? I don't want to call all the views again (code duplication). Is there a way to call a controller (something like $this->call->controller('formpage') on form error, passing all the error messages to it and it's views? Thanks. Calling a controller after validation error - El Forum - 02-26-2008 [eluser]xwero[/eluser] I'm not sure how your code looks like but if you put your view calls in the method you can do Code: function page() Calling a controller after validation error - El Forum - 02-26-2008 [eluser]palaniappanc[/eluser] xwero, thanks. I didn't want to call multiple views though, and have figured out a method to do this. In the formpage controller, I have the function 'index' (that displays the form, calling multiple views) and a function called 'validate' which does exactly that. On form error, the validate function just calls the index function. This way, the error variables are available, and I don't have to call multiple views. |