CodeIgniter Forums
[RESOLVED] Issue with validation + coolfactor's View library (I'm a retard) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [RESOLVED] Issue with validation + coolfactor's View library (I'm a retard) (/showthread.php?tid=9868)



[RESOLVED] Issue with validation + coolfactor's View library (I'm a retard) - El Forum - 07-10-2008

[eluser]awpti[/eluser]
So, I'm using coolfactor's View library for ignitedjobs.com

Whenever I 'run' the validation, any 'part' I set doesn't get defined in the view, ex (in the controller):

$this->view->part('header', 'tpl/header');
$this->view->part('footer', 'tpl/footer');

And based upon the true/false of $this->validation->run(), I load the body ( $this->view->load('job_accepted'); )

This, for a reason I can not fathom, results in $header and $footer being undefined in the view.

You can see it here:

http://ignitedjobs.com/addjob/

Just hit submit (there's no code to handle the results other than the validation run - it's not creating entries).

Code is the same as any other page method.

Should I ditch CF's view library? I didn't see any way to handle 'parts' with CI's view lib.


[RESOLVED] Issue with validation + coolfactor's View library (I'm a retard) - El Forum - 07-10-2008

[eluser]awpti[/eluser]
Other info:

Here's the 'index':

Code:
function index()
{
  // This only renders the form.
  $this->view->part('header', 'tpl/header');
  $this->view->part('footer', 'tpl/footer');
  $this->view->load('add_job');
}

And the validation:

Code:
function validate()
{
    $this->view->part('header', 'tpl/header');
    $this->view->part('footer', 'tpl/footer');
    // Set the validation rules.
    $rules = array
    (
           'location'              => '',
           'email'                 => 'required|valid_email',
           'job_title'             => '',
           'description'           => '',
           'to_apply'              => ''
    );

    $this->validation->set_rules($rules);
    if ($this->validation->run() == FALSE)
    {
           $this->load->view('add_job');
    }
    else
    {
           $this->load->view('job_accepted');
    }
}