1

i'm basically trying to check if a field contains characters only instead of string or integers tried using custom() method to return regex true or false but giving error maybe syntax error quite new to cake 3

  $validator
         ->requirePresence('field','create')
         ->notEmpty('field')
          ->add('field','custom', ['check' => 'field', 'regex' => ['A-Za-z']
            ['message' => 'chars only']);

giving this error below...

Unable to call method "" in "default" provider for field "field"

cartz_1
  • 31
  • 3

1 Answers1

-1

->add('field',[ 'custom' => [ 'check' => 'field', 'regex' => '/[A-Za-z ]/', 'message' => (__("Only Alphabets Allowed")), ] ] );

Prit Hirpara
  • 168
  • 10