diff --git a/forms/CustomRequiredFields.php b/forms/CustomRequiredFields.php index 47c39defa..c0bb5c53c 100755 --- a/forms/CustomRequiredFields.php +++ b/forms/CustomRequiredFields.php @@ -60,7 +60,7 @@ class CustomRequiredFields extends RequiredFields{ eval($field['php']); }else if($fields->dataFieldByName($field)) { // if an error is found, the form is returned. - if(!$data[$field]) { + if(!$data[$field] || preg_match('/^\s*$/', $data[$field])) { $this->validationError( $field, sprintf(_t('Form.FIELDISREQUIRED', "%s is required"), $field), diff --git a/javascript/Validator.js b/javascript/Validator.js index 5970fce3b..cab136ffa 100755 --- a/javascript/Validator.js +++ b/javascript/Validator.js @@ -95,8 +95,6 @@ function require(fieldName,cachedError) { var set = el.value; } - - var baseEl; // Sometimes require events are triggered of @@ -132,7 +130,7 @@ function require(fieldName,cachedError) { } // This checks to see if the input has a value, and the field is not a readonly. - if((typeof set == 'undefined' || set == "")) { + if( ( typeof set == 'undefined' || (typeof(set) == 'string' && set.match(/^\s*$/)) ) ) { //fieldgroup validation var fieldLabel = findParentLabel(baseEl);