Bugs or strange behaviour in the Form_validation library. - 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: Bugs or strange behaviour in the Form_validation library. (/showthread.php?tid=23132) |
Bugs or strange behaviour in the Form_validation library. - El Forum - 10-01-2009 [eluser]Bramme[/eluser] Thread that started it for me: http://ellislab.com/forums/viewthread/130649/ There are two things that bother me with the form validation library. And both are in these lines of the _execute function. Code: // If the field is blank, but NOT required, no further tests are necessary First, as explained in the above thread, a \w in the regex that checks for callbacks instead of a . cuts off the optional parameter for custom callbacks. Seems like custom callbacks should support this to me, so that's why I've changed it. The second problem I have is with the "If the field is blank, but NOT required, no further tests are necessary" logic. This logic is correct in all cases, but one (I think): when you're testing a file input. The current "required" rule does not check if a file is selected for file inputs. That's why I added a custom callback. However, to clean up my controller, I wanted to move this callback to MY_Form_validation. But since "required" isn't set for the file inputs, the second rule gets skipped over. I hope I'm making somewhat sense. I'm going to have a look at the "required" part of the _execute function and see if I can improve it a little bit. |