[solved]Custom Validation? - 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: [solved]Custom Validation? (/showthread.php?tid=44083) |
[solved]Custom Validation? - El Forum - 08-02-2011 [eluser]Mirge[/eluser] [quote author="brucebat" date="1312331674"]Correct My function is within the Controller class. The example uses the $str as an argument, Code: function username_check($str) Post the entire controller please. And yes, $str is fine. You could call it $someStupidLongVariableNameThatIProbablyShouldNotUse if you wanted. [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]brucebat[/eluser] Too big for the forum so here is Pastebin Link http://pastebin.com/axRVAB8u Thanks [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]Mirge[/eluser] Put something like: echo 'got here - inside for loop'; immediately after the opening brace of the for loop.. make sure it's even getting in there. EDIT: I don't see a constructor. And is form_validation library auto-loaded? [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]brucebat[/eluser] Code: echo "hello".$i; Okay tried that and it is working: So if the user completes three rows I get: Quote:hello0 [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]Mirge[/eluser] See my edit, sorry. [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]brucebat[/eluser] form_validaiton is autoloaded. Would a constructor be necessary? From my understanding of constructors in C++ they are used to create class attributes and set values? But in my class there are no attributes being shared in the class? Thanks [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]Mirge[/eluser] Not sure if they're required or not... I do know you have to call parent::__construct() if you have a constructor. Not sure if the base class constructor gets called automatically or not. I'd add a constructor & see if it does anything. If not, was only a few seconds lost. [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]brucebat[/eluser] Ok I placed a constructor in the class, should I put anything inside it? So far its not done anything Hmmm [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]Mirge[/eluser] Code: public function __construct() Very strange issue, if that doesn't work. I'll have to look at code again. [solved]Custom Validation? - El Forum - 08-02-2011 [eluser]brucebat[/eluser] DOH!!! I am so silly, I was calling the error reporting before the form_validation was being run. Okay so the form_validation works and the function is getting called as the "hello world" echo i put it in it is being displayed however it is not giving an error message. |