Problems with the new 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: Problems with the new Form Validation library (/showthread.php?tid=12441) Pages:
1
2
|
Problems with the new Form Validation library - El Forum - 10-19-2008 [eluser]Bramme[/eluser] Okay, I'm running into some problems with the new Form validation library. I'm not sure if it's bugs or if I'm doing smth wrong, so I'd like to post here first. First up: using a config file to set rules. I changed a field name from "name" to "username", suddenly validation says the field isn't set. When I move the config array to my controller and use set_rules() everything is fine. A second problem I have is with custom callbacks: I made a callback "unique_username" though I don't like the idea of placing it in my controller so I extend the form_validation library with MY_form_validation.php, however nothing worked. I eventually found out you have to use MY_Form_validation.php. I dunno if this is a bug or not, but I really think CI should be a little bit less harsh on upper/lower case naming conventions. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]Bramme[/eluser] I'm gonna bump this a little so it doesn't get moved to the second page and is lost forever, never to be answered... Nobody got a clue what's happening? Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]xwero[/eluser] 1. you can check if the right configuration is passed on to the run method when you do Code: print_r($this->form_validation->_field_data); 2. It's not a bug it is to reduce the checking of files which is better for performance. If you allow a capitalized first letter of the name or a lowercased name you have to do something like Code: $filename_array = array(strtolower($filename),ucfirst(strtolower($filename)); Code: $filename = ucfirst(strtolower($filename); Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]Bramme[/eluser] When I print and submit I get nothing, when I use the set_rules() function, I get the array with my fields. note though: set_value() still doesn't work. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]xwero[/eluser] you have to put the print_r function after the run method is called. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]Bramme[/eluser] [quote author="xwero" date="1224521045"]you have to put the print_r function after the run method is called.[/quote] Doesn't make a difference in my app: when the page is new, I just get an empty array, when I submit it, the array gets filled with rules and so. Which is the way the library works: Code: // No reason to set rules if we have no POST data However, this only happens when I set the array with the set_rules function. When I use the config file group it fails. I wanted to enable debug logging, but my shite shared host crashes when I enable logging. I really should develop on my localhost, but I can't seem to get mod_rewrite to work. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]xwero[/eluser] Another way to check if the group you want is loaded is Code: print_r($this->form_validation->_config_rules); Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]Bramme[/eluser] That one just stays empty, even if validation is working! Weird stuff. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]xwero[/eluser] It seems they still have a lot of work on the new validation library before it is released. Problems with the new Form Validation library - El Forum - 10-20-2008 [eluser]Bramme[/eluser] Apparently yeah, I'm gonna revert to the current CI version I think. |