function DbtngExampleUpdateForm::validateForm
Same name in other branches
- 3.x modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php \Drupal\dbtng_example\Form\DbtngExampleUpdateForm::validateForm()
- 4.0.x modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php \Drupal\dbtng_example\Form\DbtngExampleUpdateForm::validateForm()
File
-
dbtng_example/
src/ Form/ DbtngExampleUpdateForm.php, line 153
Class
- DbtngExampleUpdateForm
- Sample UI to update a record.
Namespace
Drupal\dbtng_example\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// Confirm that age is numeric.
if (!intval($form_state->getValue('age'))) {
$form_state->setErrorByName('age', $this->t('Age needs to be a number'));
}
}