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.
Just a quick question. Is there a way to validate the max length of a "select or other" selection made using the "select or other module". Doesn't seem possible, but maybe I'm missing something.
Comments
Comment #1
svendecabooterYes you could change the default settings in your custom module, by using hook_webform_validator_alter, like this:
This assumes the internal component type name for a Select (or other) webform component is in fact 'select_or_other'.
I might add this component to the default settings after I tested that module's webform component in some detail.
Comment #2
svendecabooterActually the above doesn't make sense.
The select or other module just adds extra functionality on top of the "select" component, so all validation rules that work for that component, will work with Select or Other as well.
The max length validator doesn't work with select components, because we assume that the options in the select component are defined by an administrator, so these shouldn't be validated, as there is no end-user input.
Of course if you add the "Select or Other" module end-user input becomes possible...
I have now added support for the Select (or Other) module, so what you are trying to achieve will now be possible with the latest code
Comment #3
svendecabooterComment #5
NWOM CreditAttribution: NWOM commentedAwesome! Thank you for the help.