2

I have to develop a contest page. Every participant may have one or more codes that can use to participate in the event. After that the user must fill a form with their personal data so they can be contacted in case they win the contest.

How could I add a [+] button that opens a modal window asking me how many code field would I need? If I write 5 for example, we create dynamically 5 code fields to the input.

I managed to create an add more button that add just one more button, but for clients requirements, we need to use a popup that ask how many fields we need.

2
  • Welcome to Drupal Answers! Are you sure you are using webform module to create the fields?
    – AKS
    Jan 20, 2015 at 11:15
  • Yup, I can add the fields when using the webform module. My problem is when the visitors enter the webform.
    – MrJeeba
    Jan 20, 2015 at 13:03

1 Answer 1

0

I am not sure how this can be done entirely with Webforms. One option is to include in this webform all necessary fields, including the ones that would appear as a modal dialog. Even better, group these as a fieldset.

Then in a custom module or theme include some jQuery logic with which would be very easy to create a modal dialog in the same page. There is a dialog widget in jQuery UI and this is a relevant question in SO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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