Welcome Guest, Not a member yet? Register   Sign In
Use form_validation on data sets
#1

[eluser]MaartenW[/eluser]
I'm working on a website where a moderator makes user accounts by entering user info.
This info might not be complete.
When a user logs in, the system validates the known user data and depending on the outcome sends him/her to a profile-completion form.

Is it possible to use the Form Validation class for this?

I'd love to use something like
Code:
form_validation->run('user/profile', $userData);
because that would mean there's only one place to adjust validation rules if necessary.

Any tips?

Thanks,
Maarten
#2

[eluser]Damien K.[/eluser]
If your validation rules are in a config file, you can populate $_POST and then call $this->form_validation->run('profile').

Like many things, you may want to have a wrapper class around the implementation...
#3

[eluser]MaartenW[/eluser]
Thanks for your reply.

Yes, thought about that but I might find myself in a situation where I want to validate both the original dataset AND the posted dataset.
Could write a wrapper class that holds the original posted data while checking the set though. Hm, not a very elegant approach but it might work!

Thanks,
Maarten




Theme © iAndrew 2016 - Forum software by © MyBB