![]() |
Pulling my hair out implementing form validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Pulling my hair out implementing form validation (/showthread.php?tid=20027) Pages:
1
2
|
Pulling my hair out implementing form validation - El Forum - 06-25-2009 [eluser]CI Evan[/eluser] Seems the form validation class won't execute any callbacks or formatting functions unless the field is required. Code: // controller With valid input for both fields, $_POST['effective'] is processed and outputted as a numeric timestamp, where as $_POST['expiration'] is not processed at all and instead outputted as the string originally entered (12/31/2009). What am I doing wrong? Pulling my hair out implementing form validation - El Forum - 06-25-2009 [eluser]ggoforth[/eluser] don't think the $_POST array is actually manipulated. Try using set_value('field_name') instead of the post array. That or $this->input->post('field_name'). Give that a shot and see if it works. Pulling my hair out implementing form validation - El Forum - 06-25-2009 [eluser]Colin Williams[/eluser] Quote:Seems the form validation class won’t execute any callbacks or formatting functions unless the field is required. This was fixed in the latest version. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]CI Evan[/eluser] @ggoforth: $_POST is manipulated, or the value for $_POST['effective'] wouldn't be affected. set_value() and $this->input->post() both give the same result anyway. @Colin Williams: Just downloaded the latest off of the front page and got the same result. Did you mean svn trunk? Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]CI Evan[/eluser] @Colin Williams: svn trunk gives same result as well. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]VernonK[/eluser] This might be out of left field and only because it's Friday, but... Do you think the extra underscore (e.g _valid_date -> callback__valid_date) is throwing off CI? CI is looking for something like: callback_valid_date. I know it sounds crazy, but it would only take a minute to check. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]CI Evan[/eluser] @VernonK: tried your suggestion, same result. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]Michael Wales[/eluser] Quote:This might be out of left field and only because it’s Friday, but… Do you think the extra underscore (e.g _valid_date -> callback__valid_date) is throwing off CI? CI is looking for something like: callback_valid_date. I know it sounds crazy, but it would only take a minute to check. No, that is actually the preferred way to do it. otherwise, people would be able to access those functions via the URL. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]VernonK[/eluser] Oh right... duh... Like I said... out of left field. Pulling my hair out implementing form validation - El Forum - 06-26-2009 [eluser]CI Evan[/eluser] @michael Wales: Aware you have extensive knowledge of the framework, any ideas as to why this is not working or potential work arounds? |