Getting this error for a textfield.

modules/contrib/clientside_validation/src/Plugin/CvValidator/MaxLength.php - Line 27
I changed:
if ($element['#type'] == 'select') {

To:
if (isset($element['#type']) && $element['#type'] == 'select') {

Notice: Undefined index: #type in Drupal\clientside_validation\Plugin\CvValidator\MaxLength->getRules() (line 27 of modules/contrib/clientside_validation/src/Plugin/CvValidator/MaxLength.php).
Drupal\clientside_validation\Plugin\CvValidator\MaxLength->getRules(Array, Object) (Line: 38)
Drupal\clientside_validation\CvValidatorBase->addValidation(Array, Object) (Line: 55)
clientside_validation_add_validation(Array, Object, 'node_company_edit_form') (Line: 33)
clientside_validation_form_after_build_recurse('node_company_edit_form', Array, Object) (Line: 43)
clientside_validation_form_after_build_recurse('node_company_edit_form', Array, Object) (Line: 43)
clientside_validation_form_after_build_recurse('node_company_edit_form', Array, Object) (Line: 21)
clientside_validation_form_after_build(Array, Object)
call_user_func_array('clientside_validation_form_after_build', Array) (Line: 1053)
Drupal\Core\Form\FormBuilder->doBuildForm('node_company_edit_form', Array, Object) (Line: 557)
Drupal\Core\Form\FormBuilder->processForm('node_company_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

CommentFileSizeAuthor
#2 2885443-notice-undefined-index-type.patch797 bytesPascal-

Comments

Jodan created an issue. See original summary.

Pascal-’s picture

StatusFileSize
new797 bytes

Status: Needs review » Needs work

The last submitted patch, 2: 2885443-notice-undefined-index-type.patch, failed testing. View results

Pascal-’s picture

Project: MaxLength » Clientside Validation
nikunjkotecha’s picture

Status: Needs work » Needs review

Pushing the fix as it's not having any impact but just wondering why will an element be there with maxlength check added but no #type set :think:.

Status: Needs review » Needs work

The last submitted patch, 2: 2885443-notice-undefined-index-type.patch, failed testing. View results

nikunjkotecha’s picture