• I want to build a form where users select their numbers for a draw, but the numbers cannot be repeated.

    Example:

    The first user will see the numbers
    1-2-3-4-5-6-7-8-9-10 and in the form select 2 and click “send”

    The second user when viewing the options will see
    1-3-4-5-6-7-8-9-10 (the 2 was already chosen by the previous user) so he selects the 8 and hits “send”

    The third user when entering the form will see
    1-3-4-5-6-7-9-10

    How can you create a field like that?

    • This topic was modified 1 year, 10 months ago by Ravioli.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, you’d probably need to do a custom Form-tag to display this:

    https://contactform7.com/2015/01/10/adding-a-custom-form-tag/

    It would take some custom PHP to deal with the number selection, plus you’d need to store the list of numbers and the selected numbers. One way to do that would be store those values in two custom fields in the page the form appears in. E.g. one custom field for an array of the initial numbers and one for the selected numbers, you pull out the values on page load, check which ones are selected already and then show the ones that are still available. It might possibly need some JavaScript to hand the selection.

    One other consideration would be how you handle concurrent users, if two or more people view the page at exactly the same time they could select the same number and submit it, not sure how you would easily prevent that though.

    Hope that helps!

    Thread Starter Ravioli

    (@riflefish1)

    Thanks for the response Rick. It does help, however in the way for me to know it would become too complex for me to implement. I was kind of wishing for a built-in feature in CF7 that I didn’t discover yet, so I’m afraid that I’ll have to go and look for some alternatives.

    Thanks for the insight!

    No worries. Yep, this would definitely need to be some custom work to implement as it’s beyond the scope of standard form fields.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Number draw’ is closed to new replies.