I'm building a multi page webform in Drupal 8 as shown below
(1) Consent to ask questions >>> (2) Chekcing eligiblity >>> (3) Consent to Participate >>> (4) Base line info >>> (5) Complete
In the 2nd page (Checking eligibility) as soon as the user clicks on Next Page > button, I need to validate the submitted values (which contains several radio buttons) and assess the user whether he is eligible to participate in a survey or not.
/*
* hook_form_FORM_ID_alter()
*/
function webform_form_webform_submission_registration_content_node_77_form_alter(&$form, FormStateInterface $form_state, $form_id) {
...
if($form_id == 'webform_submission_registration_content_node_77_form')
{
$form['#submit'][] = 'webform_webform_submit_handler';
}
}
function webform_webform_submit_handler($form, &$form_state) {
/* This is not displaying any submited values mostly because I haven't clicked on Sumbit button yet */
dpm($form_state['values']);
}
src: https://www.drupal.org/node/2634266
Is there any way to get the Form's draft values before submission? Any better approach to process the values within the page(form) itself? Any help much appreciated.