![]() |
Validation Bug - 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: Validation Bug (/showthread.php?tid=2956) |
Validation Bug - El Forum - 09-01-2007 [eluser]adamp1[/eluser] I was writing a new form for my website, when I needed to check first if a date was in the correct format, then if it was not in the past so I created the following code: Code: $rules['expire'] = 'callback_dateformat|callback_dateinpast'; So now if I don't enter a correct date I get the first error, but if I enter correct date but one in the past I don't get an error. Now I know were the problem is. If I have the following field rule. Code: $rules['expire'] = 'required|callback_dateformat|callback_dateinpast'; It will work, since in Validation.php Line 279 it only moves on if the result is TRUE and its required. Otherwise it cuts out. Now its fine when only one callback is used but with two it breaks. Validation Bug - El Forum - 09-02-2007 [eluser]CodeOfficer[/eluser] Hmmm, i thought we were only able to use one custom validation callback per field rule. Validation Bug - El Forum - 09-02-2007 [eluser]adamp1[/eluser] I didn't know we are only allowed one callback, that sounds a bit silly to me. So if you are then surely the above shouldn't be allowed. Seems to be a problem somewhere. Validation Bug - El Forum - 09-02-2007 [eluser]CodeOfficer[/eluser] I believe thats one of the reasons people usually extend the validation class, one of those things you find out the hardway about CI ... it does some things absolutely great! and others not so much. Validation Bug - El Forum - 09-03-2007 [eluser]JayTee[/eluser] Why not use a single callback? Does it have to be two? Code: $rules['expire'] = 'callback_date_valid'; I just threw that together, but you get the idea. Jon |