0
votes

When inside a webform, that was created with the module webform - I need to validate / check the entries of a page when submit/"next step" is clicked- So before the user moves to the next page(pagebreak).

I want to check if the email address was entered already - if so show this as an error without moving to the next page.

I need a hook .. or a way to tell drupal "go to step 1" instead of showing step 2.

1

1 Answers

0
votes

You can use a hook to check the value of the form. In hook form alter you can check your field values.

$form['#validate'][] = 'function_to_validate_field';

function check_for_company_validate($form, &$form_state) {
//do stuff
}

You can see this for drupal 7 to create an error:

https://api.drupal.org/api/drupal/includes!form.inc/function/form_set_error/7