"name" is marked as an error because it is required
"islowercase" is not marked even though it containes uppercase letters. BAD
"name" is marked as an error because it is required
"islowercase" is not marked because containes uppercase letters. GOOD
It doesn't matter what goes into the lowercasetext. The validator never returns an error. BAD
Possible Problems
This does not seem to be related to the lexicon file, because there is a string for this error:
formit.not_lowercase - en: This field must be all lowercase.
formit.not_lowercase - de: Dieses Feld bitte nur in Kleinbuchstaben ausfüllen.
Ths issue should be located in validator.php, but to be honest I can't see what could ever go wrong here:
core/components/formit/src/FormIt/Validator.php, LINE # 678
/**
* Checks to see if a string is all lowercase
* @param string $key The name of the field
* @param string $value The value of the field
* @return boolean
*/
public function islowercase($key, $value)
{
$v = $this->config['use_multibyte'] ? mb_strtolower($value,$this->config['encoding']) : strtolower($value);
return strcmp($v, $value) == 0 ? true : $this->_getErrorMessage($key,'vTextIsLowerCase','formit.not_lowercase',array(
'field' => $key,
'value' => $value,
));
}
According to my phpinfo page "Multibyte decoding support using mbstring" is enabled and the setting for "use_multibyte" is true. Comparing the original value with the strtolower or mb_strtolower.
Question: What is $this->config['encoding'] supposed to return? It is not a setting that can be displayed on the settings page. Neither core nor formit have this variable.
Expected behavior
"LOWER" should return an error. BAD
"lower" should not return an error. FINE
Before you read this...
The problem was caused because I have a habit of putting commas in front of the following line:
This breaks the validation.
This works.
In a similar bug report reported by me the issue was caused by the same problem.
Bug report
Summary
islowercase always seems to return true, regardless of validated content.
Step to reproduce
Observed behavior
Insert string "lower"
After submiting the form:
Insert string "LOWER"
After submiting the form:
"name" is marked as an error because it is required
"islowercase" is not marked even though it containes uppercase letters. BAD
"name" is marked as an error because it is required
"islowercase" is not marked because containes uppercase letters. GOOD
It doesn't matter what goes into the lowercasetext. The validator never returns an error. BAD
Possible Problems
This does not seem to be related to the lexicon file, because there is a string for this error:
Ths issue should be located in validator.php, but to be honest I can't see what could ever go wrong here:
core/components/formit/src/FormIt/Validator.php, LINE # 678
According to my phpinfo page "Multibyte decoding support using mbstring" is enabled and the setting for "use_multibyte" is true. Comparing the original value with the strtolower or mb_strtolower.
Question: What is $this->config['encoding'] supposed to return? It is not a setting that can be displayed on the settings page. Neither core nor formit have this variable.
Expected behavior
"LOWER" should return an error. BAD "lower" should not return an error. FINE
Environment
MODX 2.8.1, Formit 4.2.6 , PHP 7.4.18, Apache Webserver Running on Ubuntu Linux.