- Issue created by @Sunil Chaurasiya
I have a multistep form that have 5 steps
welcome, personal_information, validate_otp, accounts_details, webform_complete.
User can fill the form anonoumsly after OTP verification.
Now i have to allow user to edit this form anonymously using secure token, i am using mobile number at time of form submit to get submission id and creating a edit url with secure token and redirecting the user directly on accounts_details page as it should only user can edit.
When i redirect user to accounts_details page webform automatically redirects to first i.e welcome page.
to fix this i have added a code to stay on current page.
function otp_webform_webform_submission_prepare_form(\Drupal\webform\WebformSubmissionInterface $webform_submission, $operation, \Drupal\Core\Form\FormStateInterface $form_state) {
$current_page = \Drupal::request()->query->get('page');
if($current_page == 'accounts_details'){
$pages = $webform_submission->getWebform()->getPages();
if (isset($pages[$current_page])) {
$form_state->set('current_page', $current_page);
}
}
now I am able to stay on current page i.e accounts_details page. But when i chane the info and click on next button it redirecting me to second page i.e personal_information page.
how i can fix this.
Active
6.3
Code