I have a webform with 195 different select options, each with their own form key.

I want to make the form so someone can only select 10 items, but the max number validation isn't working so I'm trying to figure out how to make this work.

I cannot group them under one form key so I'm hoping someone can help me out.

put on hold as unclear what you're asking by mradcliffe, leymannx, DRUPWAY, Shawn Conn, kiamlaluno 10 hours ago

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Is this related to the webforms module or to the Forms API? – Rainer Feike Dec 9 at 13:26
  • I'm assuming the webforms module, I'm trying to use the max select option from the validation page, but it doesn't seem to recognize that it should only pick 10 from the entire page since each item is an individual option. – T.J. Dec 11 at 16:32

You can use webform_validation contribute module. As the description of the module page, It has the following options:

  • Numeric values (optionally specify min and/or max value)
  • Minimum length
  • Maximum length
  • Minimum number of words
  • Maximum number of words
  • Equal values on multiple fields
  • Unique values on multiple fields
  • Specific value
  • Require at least one of two fields
  • Require at least one of several fields
  • Minimum number of selections required
  • Maximum number of selections allowed
  • Exact number of selections required
  • Plain text (disallow tags)
  • Regular expression
  • Must be empty (anti-spam: Hide with CSS)
  • Words blacklist
  • Must match a username
  • That's what I've been trying to do, but it's not working. Each item is listed as an individual element so and the max selection only works in a list of options, but since each item is a different option it doesn't seem to recognize that that max selection should apply to all items on the page. – T.J. Dec 11 at 16:31

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