Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everybody !
I use webform with multistep for a quiz. I want to add a "skip" button (equivalent to the submit/next button in the bottom of the form) above the form so that people can go directly to the next question without having to scroll down the page like that :
Skip this question
My form
< Previous | Next >
I succeeded to add an another submit button (check code below). But when I click on this button it returns to the previous step instead of going to the next step ... I don't understand why .. And I can not put it above the form.
function mytemplate_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'webform_client_form_13':
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('skip'),
);
break;
}
}
Have you got an idea for help me ?
Thanks you for advance
PS : sorry for my bad english
Comments
Comment #1
pierre521 CreditAttribution: pierre521 commentedComment #2
DanChadwick CreditAttribution: DanChadwick commentedYou can probably use hook_form_webform_client_form_alter as you suggested to make another "Next" button, but placed at the top of the form. You'd have to read the code to see what issues there might be. Without reading the code, I'm not sure how the Next button is identified, and whether it has its own submit handler. The safest way would be to copy the existing button, changing it as desired.
Beyond that, we don't supply custom programming support in the webform issue queue. Try the forums or IRC. Good luck.
Comment #4
pal4life CreditAttribution: pal4life commentedNot entirely sure but maybe Webform_steps module may help you with that.
https://www.drupal.org/project/webform_steps
Comment #5
DanChadwick CreditAttribution: DanChadwick commented@pal4life -- thank you for your help in the issue queue! It is very much appreciated.