Reputation: 11
$this->form_validation->set_rules('calls_abandoned', 'Calls
abandoned',
'required|integer|greater_than_or_equal_to[0]|less_than[101]|decimal');
Upvotes: 1
Views: 1998
Reputation: 4331
You can try custom validation like this :
function maximCheck($num)
{
if ($num > 0 && $num < 100)
{
return TRUE;
}
else
{
$this->form_validation->set_message(
'your_field',
'The %s field must be in 1 to 100'
);
return FALSE;
}
}
$this->form_validation->set_rules(
'your_field', 'Your Number', 'callback_maximCheck'
);
Upvotes: 0
Reputation: 2220
Try the rule is_natural
from http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#rulereference
$this->form_validation->set_rules('calls_abandoned', 'Calls abandoned', 'required|integer|is_natural|less_than[101]|decimal');
Upvotes: 1