Welcome Guest, Not a member yet? Register   Sign In
CI form validation in models/libraries?
#1

[eluser]ch5i[/eluser]
Hello,

I know this has been asked several times already, but I have not been able to find any good examples for this the forums.

Basically I want to make controller functions available to more than one controller, eg. generic listings or forms, so the way to do it would be to create own models/libraries (I guess).

I would like to shift form validation to a model or library so that I do not have to duplicate code.

Are there any good examples (using CI's validation class)?
Should I use models or libraries for this?


Thanks for any hints!
#2

[eluser]xwero[/eluser]
see this thread
#3

[eluser]ch5i[/eluser]
Thank you, xwero.

I found the same thread maybe 5mins after posting - typical Smile

So does this say that CI's validation class is not actually suited for inclusion in models?
Sorry if I'm asking something obvious...

Wouldn't it make sense to store validation rules for every database field the user can modify (in principle)?
The user model would for instance contain a collection of field class instances which extend a DBtableField class which in turn would have a built in validation function.

Mindless ramblings...




Theme © iAndrew 2016 - Forum software by © MyBB