Custom Form Validation function don't work |
[eluser]sohei[/eluser]
Hi all, I have a problem with my form_validation. It always return FALSE. I have to validate a date input, so that's what i've done: My rule in my 'form' function: Code: $this->form_validation->set_rules('input_Date', 'Date', 'callback_date_check'); And my custom validation function: Code: function date_check($str) { It looks like he does not recognize $str. If that..What should I put instead? Thanks! sohei
[eluser]smilie[/eluser]
Your function should look like: Code: function date_check() { $str is not defined anywhere - thus you always get FALSE. Simply use: this->input->post('input_field_name') and it should work correctly. Cheers, Smilie
[eluser]farhad zand[/eluser]
Code: function date_check() { Go gon take away
[eluser]sohei[/eluser]
Arf, It works now, thanks. PS:I found it strange too, but in the userguide example, $str is not defined either. So I thought it was a default attribute. (http://ellislab.com/codeigniter/user-gui...l#tutorial) |
Welcome Guest, Not a member yet? Register Sign In |