diff --git a/application/modules/default/forms/addemployeeleaves.php b/application/modules/default/forms/addemployeeleaves.php index db1c47293..d533e8a00 100644 --- a/application/modules/default/forms/addemployeeleaves.php +++ b/application/modules/default/forms/addemployeeleaves.php @@ -32,7 +32,7 @@ public function init() $emp_leave_limit = new Zend_Form_Element_Text('leave_limit'); $emp_leave_limit->setLabel("Allot Leave Limit"); - $emp_leave_limit->setAttrib('maxLength', 3); + $emp_leave_limit->setAttrib('maxLength', 4); $emp_leave_limit->addFilter(new Zend_Filter_StringTrim()); if($id_val == '') { @@ -64,7 +64,7 @@ public function init() $emp_leave_limit->addValidator("regex",true,array( - 'pattern'=>'/^(\-?[1-9]|\-?[1-9][0-9])$/', + 'pattern'=>'/^\d{0,2}(\.\d{1,1})?$/', 'messages'=>array( 'regexNotMatch'=>'Leave limit must be in the range of 0 to 100.' diff --git a/application/modules/default/views/scripts/addemployeeleaves/add.phtml b/application/modules/default/views/scripts/addemployeeleaves/add.phtml index 69d2701ac..da7b211c7 100644 --- a/application/modules/default/views/scripts/addemployeeleaves/add.phtml +++ b/application/modules/default/views/scripts/addemployeeleaves/add.phtml @@ -77,7 +77,7 @@ function enableLeaves(userid) { function validateEmployeLeaves() { var errorcount = 0; var enabledcount = 0; - var re = /^[0-9]+$/; + var re = /^\d{0,2}(\.\d{1,1})?$/; $('.emp_leave_cls').each(function(i){ var ele= $(this).find('.add_emp_leaves'); var elementid = $(ele).attr('id'); @@ -93,7 +93,7 @@ function validateEmployeLeaves() { } else if(!re.test(reqValue)) { - $(ele).parent().append("Please enter only number."); + $(ele).parent().append("Only 1 digit allowed after decimal."); $(ele).addClass('borderclass'); errorcount++; }else if(!$(ele).is(':disabled')) diff --git a/application/modules/default/views/scripts/index/getmultiemps.ajax.phtml b/application/modules/default/views/scripts/index/getmultiemps.ajax.phtml index 70599a627..2a042530d 100644 --- a/application/modules/default/views/scripts/index/getmultiemps.ajax.phtml +++ b/application/modules/default/views/scripts/index/getmultiemps.ajax.phtml @@ -43,7 +43,7 @@
- +
diff --git a/public/media/js/hrmsv2.js b/public/media/js/hrmsv2.js index ec4fbff85..1faa9a00a 100644 --- a/public/media/js/hrmsv2.js +++ b/public/media/js/hrmsv2.js @@ -967,6 +967,31 @@ function validateratingsonsubmit() } } + function validateNumberInputForEmpLeave(ele,msg) + { + + var elementid = $(ele).attr('id'); + var value = $(ele).val(); + var re = /^\d{0,2}(\.\d{1,1})?$/; + $('#errors-'+elementid).remove(); + $(ele).removeClass('borderclass'); + if(value == '') + { + $(ele).parent().append("Please enter leaves."); + $(ele).addClass('borderclass'); + } + else if(!re.test(value)) + { + $(ele).parent().append("Only 1 digit allowed after decimal."); + $(ele).addClass('borderclass'); + } + else + { + $('#errors-'+elementid).remove(); + $(ele).removeClass('borderclass'); + } + } + function updateleavedetails(leaveid,controllername) { if(!leaveid)