0

I have created a webform in Drupal. It has a pagebreak after every question.

What I want to achieve is the following: When someone clicks on a radio button, the next question should slide up without the user clicking the next page button.

I have tried with theming, but I am not very experienced with Drupal, PHP, or jQuery.

This is the link to my webform.

0

You can add to your page something like

<script>
(function ($, Drupal, window, document, undefined) {
  $(document).ready(function() {
    $('.form-radio').click(function() { $('#edit-next').click(); });
  });
})(jQuery, Drupal, this, this.document);
</script>

This is better done by adding a .js file via drupal_add_js(). Be aware that, since you are forcing your user to submit a form, you should provide a way to get back and resubmit a different choice.

  • hi thanks for ur help i have actually done that but it keeps going backwords after one question also i have radio buttons with text field which a person has to fill in the text and hen press next page on some of the questions – user16600 Apr 22 '13 at 11:55
  • I edited the answer to solve your "going backwards" problem. I didn't notice that you actually have two submit buttons in your forms after the first. To address your other question, you need to have a different class attached to your radio buttons that you need to perform automated next behavior, and put that in place of the $('.form-radio') selector. – pamatt Apr 23 '13 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.