Welcome Guest, Not a member yet? Register   Sign In
Date validation CI 1.7
#5

[eluser]xwero[/eluser]
Yes but it's messy because you have to assign rules to a input field and you have to do three validations at once and specify which error occurs. A solution could be to create a hidden field with the name birthday you give the value fake_input for example and you create a birthdate_selected callback
Code:
function birthday_selected()
{
   $not_selected = array();

   if( ! isset($_POST['year']))
   {
      $not_selected[] = 'year';
   }

   if( ! isset($_POST['month']))
   {
      $not_selected[] = 'month';
   }

   if( ! isset($_POST['day']))
   {
      $not_selected[] = 'day';
   }

   if(count($not_selected) > 0)
   {
       $this->form_validation->set_message('The '.implode(', ',$not_selected).' of the birthday are not defined');
       return FALSE;
   }

   return TRUE;
}


Messages In This Thread
Date validation CI 1.7 - by El Forum - 01-09-2009, 06:46 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 07:16 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 07:36 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 07:47 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 07:51 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 07:54 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 08:02 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 08:03 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 08:22 AM
Date validation CI 1.7 - by El Forum - 01-09-2009, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB