MongoDB + Form_Validation Method is_unique() - 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: MongoDB + Form_Validation Method is_unique() (/showthread.php?tid=54325) |
MongoDB + Form_Validation Method is_unique() - El Forum - 09-03-2012 [eluser]sweetD[/eluser] So I wanted to use the is_unique rule in my form validations, but since I'm using Alex Bilbie's Mongo Library, I needed to extend From_validation from the core. Check out what I did below, just wanted to make a quick contribution. I want it to check if lowercase also so I need to add that in there. For example right now if you enter "Peter" and is_unique "peter" it will not be the same and peter lowercase will be allowed even though "Peter" exists. Code: array( Code: <php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); MongoDB + Form_Validation Method is_unique() - El Forum - 09-20-2012 [eluser]jim-_-[/eluser] if you just run this function on both the string and what you are checking against that would even the playing field I think. Code: strtolower($str); MongoDB + Form_Validation Method is_unique() - El Forum - 09-20-2012 [eluser]sweetD[/eluser] Yea, I messed up I should strtolower when entering the data, then strtolower when comparing. |