From a2137e930592ba3813dab0d2002a6bfb55c8a0aa Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Tue, 8 Oct 2013 07:16:07 +0530 Subject: [PATCH] Facilitate input fields of type 'number' --- js/config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/config.js b/js/config.js index 58522b79cb..d064b62b57 100644 --- a/js/config.js +++ b/js/config.js @@ -61,6 +61,7 @@ function setFieldValue(field, field_type, value) field = $(field); switch (field_type) { case 'text': + case 'number': //TODO: replace to .val() field.attr('value', (value !== undefined ? value : field.attr('defaultValue'))); break; @@ -102,6 +103,7 @@ function getFieldValue(field, field_type) field = $(field); switch (field_type) { case 'text': + case 'number': return field.prop('value'); case 'checkbox': return field.prop('checked'); @@ -415,7 +417,7 @@ function validate_field(field, isKeyUp, errors) errors[field_id] = []; var functions = getFieldValidators(field_id, isKeyUp); for (var i = 0; i < functions.length; i++) { - if (functions[i][1] !== null) { + if (typeof functions[i][1] !== 'undefined' && functions[i][1] !== null) { args = functions[i][1].slice(0); } else { args = [];