CodeIgniter Forums
Use form_validation on data sets - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Use form_validation on data sets (/showthread.php?tid=22944)



Use form_validation on data sets - El Forum - 09-24-2009

[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


Use form_validation on data sets - El Forum - 10-01-2009

[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...


Use form_validation on data sets - El Forum - 10-01-2009

[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