CodeIgniter Forums
using form arrays and the validation library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: using form arrays and the validation library (/showthread.php?tid=9965)



using form arrays and the validation library - El Forum - 07-14-2008

[eluser]Unknown[/eluser]
Is there a built in method to use the validation library and form arrays?

For example I would like to have a form like:
Code:
<form>
   <input type="text" name="nickname[]" value="<?php echo $this->validation->nickname(0);?>" />
   <input type="text" name="nickname[]" value="<?php echo $this->validation->nickname(1);?>" />
   <input type="text" name="nickname[]" value="<?php echo $this->validation->nickname(2);?>" />
   <input type="text" name="nickname[]" value="<?php echo $this->validation->nickname(3);?>" />
</form>

then in the controller run something like:
Code:
$rules['nickname']     = "trim|required|min_length[5]";

$fields['nickname']    = "You most Provide a nickname that has at least 5 letters in it.";

Is this currently built in or being planned or do I have to extend the validation library to do this?