$this->form_validation->set_rules('departure_date', 'Departure Date', 'required');
I tried this above code. But the error message is not displaying.
$this->form_validation->set_rules('departure_date', 'Departure Date', 'required');
I tried this above code. But the error message is not displaying.
in your controller you nned to use this:
$this->form_validation->set_rules('departure_date', 'departure_date', 'required|regex_match[\d{4}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3(0|1))]');
$this->form_validation->set_message('required', 'Field required');
if ($this->form_validation->run() !== FALSE){
//code if validation is correct
}
in your view:
<input type="text" name="departure_date"/>
<?php echo form_error('departure_date'); ?>