mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG notice level error when value is not set on CreditCardField
This commit is contained in:
parent
9944e82e51
commit
e724d6f578
@ -59,10 +59,12 @@ class CreditCardField extends TextField {
|
||||
}
|
||||
|
||||
public function validate(Validator $validator){
|
||||
// If the field is empty then don't return an invalidation message
|
||||
if(!trim(implode("", $this->value))) return true;
|
||||
if(!$this->value || !trim(implode("", $this->value))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$i=0;
|
||||
|
||||
if($this->value) foreach($this->value as $part){
|
||||
if(!$part || !(strlen($part) == 4) || !preg_match("/([0-9]{4})/", $part)){
|
||||
switch($i){
|
||||
|
Loading…
Reference in New Issue
Block a user