Welcome Guest, Not a member yet? Register   Sign In
form validation question
#7

[eluser]rsmarsha[/eluser]
I moved the validation to a config file as suggested earlier in the post which as you said does make it tidier.

Code:
<?php
$config = array(
    'write_blog_post' => array(
        array(
            'field' => 'title',
            'rules' => 'required|xss_clean'
        ),
        array(
            'field' => 'content',
            'rules' => 'required|xss_clean'
        ),
        array(
            'field' => 'category',
            'rules' => 'is_natural_no_zero'
        )
    )                        
);

I made the changes you suggested though as this is an admin form I just have the submitted message show on the write page in case the user wants to write another post.

So : -

Code:
public function write () {
        if ($this->form_validation->run('write_blog_post') === FALSE)
        {
            $data = array(
                'categories' => $this->blog_model->get_categories(),
                'message' => (validation_errors()) ? validation_errors() : $this->session->flashdata('message')
            );
            $this->_view('admin/blog_write_post', $data);
        }
        else
        {
            $result = $this->blog_model->insert_post();
            if ($result){
                $this->session->set_flashdata('message', 'Blog Entry Submitted');        
            }
            else
                {
                $this->session->set_flashdata('message', 'An Error Occured Submitting the Post');
                
            }
            redirect('admin/blog/write');
        }
    }

I tried the order_by method you suggested and I get the same error. I've checked the fields and can't work it out, it's as if the order by breaks the query.


Messages In This Thread
form validation question - by El Forum - 06-09-2011, 01:40 AM
form validation question - by El Forum - 06-09-2011, 09:09 AM
form validation question - by El Forum - 06-09-2011, 09:26 PM
form validation question - by El Forum - 06-09-2011, 10:48 PM
form validation question - by El Forum - 06-10-2011, 01:47 AM
form validation question - by El Forum - 06-10-2011, 08:19 AM
form validation question - by El Forum - 06-13-2011, 02:06 AM
form validation question - by El Forum - 06-13-2011, 07:35 AM
form validation question - by El Forum - 06-13-2011, 11:22 AM
form validation question - by El Forum - 06-14-2011, 01:14 AM
form validation question - by El Forum - 06-14-2011, 01:33 AM
form validation question - by El Forum - 06-15-2011, 09:11 AM
form validation question - by El Forum - 06-15-2011, 10:23 AM
form validation question - by El Forum - 06-16-2011, 03:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB