CodeIgniter Forums
How do I make a form element required? - 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: How do I make a form element required? (/showthread.php?tid=3839)



How do I make a form element required? - El Forum - 10-24-2007

[eluser]Jay Callicott[/eluser]
Is there not a way to use the validation class make form elements required? If not has anyone thought of a hack or something?


How do I make a form element required? - El Forum - 10-24-2007

[eluser]maadmac[/eluser]
[quote author="Jay Callicott" date="1193294827"]Is there not a way to use the validation class make form elements required? If not has anyone thought of a hack or something?[/quote]

Take a look at the Validation class page in the user guide again, a little more carefully. It explains how to make form elements required, or valid email addresses, or whatever...

Code:
$rules['username'] = "required";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";

$this->validation->set_rules($rules);

It's all there.


How do I make a form element required? - El Forum - 10-27-2007

[eluser]Jay Callicott[/eluser]
Ya but I'm talking about files. So it's not all there, bc file elements don't populate post.