callback feature on 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: callback feature on form validation library (/showthread.php?tid=13914) |
callback feature on form validation library - El Forum - 12-11-2008 [eluser]Unknown[/eluser] Hi, The 'callback' feature on the form validation library does not seem to work. I have tried everything but the below won't work. Can someone please help? Code: class Myform extends MY_Controller { callback feature on form validation library - El Forum - 12-11-2008 [eluser]Sarfaraz Soomro[/eluser] try just the field name and the callback as the argument, don't know why you put the second argument as 'datecreated' Code: $this->form_validation->set_rules('datecreated','callback_date_check'); alternately you can try this syntax; Code: $this->form_validation->set_rules( array( 'datecreated' => 'callback_date_check' ) ); callback feature on form validation library - El Forum - 12-11-2008 [eluser]Sarfaraz Soomro[/eluser] also it's a good practice to prefix the validation callbacks with an underscore. Code: $this->form_validation->set_rules( array( 'datecreated' => 'callback__date_check' ) ); and you define your callback function as; Code: function _date_check($str) callback feature on form validation library - El Forum - 12-12-2008 [eluser]Sarfaraz Soomro[/eluser] oh i am sorry i failed to recognize earlier that you are using the new Form Validation library. I made the comment above because i am more used to the old validation class in 1.6.3 version. |