public function MortgageCalculatorForm::validateForm in Real Estate Mortgage Calculator 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ MortgageCalculatorForm.php, line 71
Class
- MortgageCalculatorForm
- MortgageCalculatorForm.
Namespace
Drupal\mortgage_calculator\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('mortgage_calculator_years_to_pay') == '' || $form_state
->getValue('mortgage_calculator_years_to_pay') <= 0) {
$form_state
->setErrorByName('mortgage_calculator_years_to_pay', $this
->t('Please enter a value of years to pay.'));
}
}