Welcome Guest, Not a member yet? Register   Sign In
callback validation help
#4

[eluser]danmontgomery[/eluser]
I believe callback functions for form_validation can only accept one parameter, which is the value of the field being validated. You would probably be passing it a string in the format of m/d/Y, or something similar.

Code:
function date_exists($date)
{
  $timestamp = strtotime($date);
  return checkdate(date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp);
}

then:

Code:
$this->form_validation->set_rules('start_date', 'Start Date', 'callback_date_exists');
$this->form_validation->set_rules('end_date', 'End Date', 'callback_date_exists');


Messages In This Thread
callback validation help - by El Forum - 01-12-2010, 12:34 PM
callback validation help - by El Forum - 01-12-2010, 01:51 PM
callback validation help - by El Forum - 01-12-2010, 02:09 PM
callback validation help - by El Forum - 01-12-2010, 02:12 PM
callback validation help - by El Forum - 01-12-2010, 02:13 PM
callback validation help - by El Forum - 01-12-2010, 02:20 PM
callback validation help - by El Forum - 01-12-2010, 02:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB