Welcome Guest, Not a member yet? Register   Sign In
Validate Drop Down Selections
#2

[eluser]iConTM[/eluser]
I would make 1 field to input the date.

If you want to use CI's formvalidation class you can do something like this:

Code:
$this->form_validation->set_rules('date', 'Date', 'callback_date_check');

Code:
function date_check ($value)
{
    $parts = explode('/', $value);
    
    // make sure that all parts are digits. otherwise the checkdate method will throw errors
  
    if ( count($parts) != 3 || !checkdate($parts[1]  ,$parts[0]  ,$parts[2]) )
    {
        $this->load->library('validation');
        $this->validation->set_message(__FUNCTION__, 'The %s field must have dd/mm/yyyy format.');
        return FALSE;    
    }
        
    return true;
}


Messages In This Thread
Validate Drop Down Selections - by El Forum - 09-01-2010, 08:57 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 10:55 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:00 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:14 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:20 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:26 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:42 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:50 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 11:59 AM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:21 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:23 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 01:35 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 04:06 PM
Validate Drop Down Selections - by El Forum - 09-01-2010, 05:54 PM
Validate Drop Down Selections - by El Forum - 09-02-2010, 12:35 AM
Validate Drop Down Selections - by El Forum - 09-02-2010, 08:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB