mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
parents-merge 41566 - Updated required validator to not allow a sequence of whitespace as a value
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45062 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
202b7fd9b6
commit
cc97834409
@ -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),
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user