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

[eluser]cideveloper[/eluser]
Another thing to deal with.

Say for example a user goes to admin/blog_write_post. They fill out the content and choose a category but forget to fill out the title. They hit submit. form validation fails and they are now redirected back to admin/blog_write_post probably with the validation error telling them title is required. With your code as it is they now have to re-select the category. It gets annoying as a user if they have to fill out stuff twice if they didn't make a mistake with that field.

Also to make your code a bit cleaner You should move this

Code:
$categories = array();
        foreach ($results AS $result) {
            $categories[$result->id] = $result->name;
        }

to the model. Then you can just do this

Code:
$data = array(
            'categories' => $this->blog_model->get_categories()
        );


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