[eluser]Unknown[/eluser]
I have extended the form validation to include some extra methods. One of them needs to check if 2 inputs are not empty together, however the method never gets called if the input is empty:
application/libraries/MY_Form_validation.php:
Code:
class MY_Form_validation extends CI_Form_validation {
public function __construct($config = array())
{
log_message('debug', 'MY_Form_validation loaded<<<');
parent::__construct($config);
}
public function lat_longs($str)
{
echo "lat_longs called";
var_dump($this->CI->input->post('map_lat'));
var_dump($str);
return FALSE;
}
application/language/english/form_validation_lang.php:
Code:
$lang['lat_longs'] = "Some error message here.";
application/config/form_valiation.php
Code:
'venues' => array(
array(
'field' => 'map_lat',
'label' => 'Latitude',
'rules' => 'trim|htmlspecialchars|lat_longs|numeric|xss_clean'
),
array(
'field' => 'map_lng',
'label' => 'Longitude',
'rules' => 'trim|htmlspecialchars|lat_longs|numeric|xss_clean'
)
),
in the view file:
Code:
<?php echo form_error('map_lat'); ?>
The lat_longs() method never seems to get called if the $_POST['map_lat'] or $_POST['map_lng'] is empty...
Any ideas?