From fc91b318045942f5b12a039ace5003f30045df5c Mon Sep 17 00:00:00 2001 From: bzuro Date: Wed, 18 Sep 2013 02:50:56 +0200 Subject: [PATCH] #141 - Maxlength for decimal numbers Fixed issue #141, so that decimal numbers have enough max-length in input field, accounting for the decimal character. --- application/libraries/Grocery_CRUD.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/libraries/Grocery_CRUD.php b/application/libraries/Grocery_CRUD.php index b38a41ac..1bbc75ff 100755 --- a/application/libraries/Grocery_CRUD.php +++ b/application/libraries/Grocery_CRUD.php @@ -2177,7 +2177,12 @@ protected function get_string_input($field_info,$value) $extra_attributes = ''; if(!empty($field_info->db_max_length)) - $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + if($field_info->type=='decimal'){ + $decimal_lentgh = explode(',',$field_info->db_max_length); + $extra_attributes .= "maxlength='".($decimal_lentgh[0]+1)."'"; + }else{ + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + } $input = ""; return $input; }