0

I have duplicated data across my config/form_validation.php and my controller. the field and label from form_validation is the same that I specify in my controller for the id, name and placeholder

Do I have to extract that data to yet a third location and reference it in both of these?

application/config/form_validation.php

$config = array(
                 'register' => array(
                                    array(
                                            'field' => 'register_username',
                                            'label' => 'Username',
                                            'rules' => 'trim|required|exact_length[5]'
                                         ),
.....

application/controllers/mycontroller.php

        $this->viewdata['register_username'] = array(
            'id'            => 'register_username',
            'name'          => 'register_username',
            'type'          => 'text',
            'placeholder'   => 'Username'
        );
...

1 Answer 1

1

I'm not sure why you have your data duplicated in the controller itself. You might find it easier to use Jamie Rumbelow's model/schema libraries mashup.

This will clean up your model/application structure as a whole. The model extension library itself allows for the automation of CRUD methods.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.