You are here

public function PollViewForm::validateVote in Poll 8

Validates the vote action.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

File

src/Form/PollViewForm.php, line 378

Class

PollViewForm
Displays banned IP addresses.

Namespace

Drupal\poll\Form

Code

public function validateVote(array &$form, FormStateInterface $form_state) {
  if (!$form_state
    ->hasValue('choice')) {
    $form_state
      ->setErrorByName('choice', $this
      ->t('Your vote could not be recorded because you did not select any of the choices.'));
  }
}