Codeigniter PHP - loading a view at an anchor point

Posted by James Billings on Stack Overflow See other posts from Stack Overflow or by James Billings
Published on 2012-09-21T15:22:21Z Indexed on 2012/09/21 15:37 UTC
Read the original article Hit count: 186

Filed under:
|
|

I have a form at the bottom of a long page, if a user fills out the form but it doesn't validate the page is reloaded in the typical codeigniter fashion:

$this->load->view('template',$data);

however because the form is way down at the bottom of the page I need the page to load down there like you do with HTML anchors. Does anyone know how to do this in codeigniter?

I can't use the codeigniter

redirect();

function because it loses the object and the validation errors are gone. Other frameworks I've used like Yii you can call the redirect function like:

$this->redirect();

which solves the problem because you keep the object. I've tried using:

$this->index()

within the controller which works fine as a redirect but the validation errors are in another method which is where the current page is loaded from:

$this->item($labs)

but when I use this it get stuck in a loop

Any ideas? I've seen this question a lot on the net but no clear answers. I'm researching using codeigniter "flash data" but think it's a bit overkill.

cheers.

© Stack Overflow or respective owner

Related posts about php

Related posts about validation