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.
It would be nice to have a validation rule that provided:
IF
(field componet A value is filled, selected, etc.)
AND
(field component B value is not already required)
THEN
(field component B value is required)
Comments
Comment #1
Liam MorlandYou could use the conditionals in Webform to do something like this. Component B could be hidden unless component A is filled. That wouldn't be exactly the same, since you might want component B to be optional when A is empty and mandatory when filled.
Comment #2
rshannon CreditAttribution: rshannon commentedThanks for a good suggestion. In my current use case, field B doesn't need to be optional even if A is empty, so it is within the scope of your suggestion, in that it's not needed at all until A is filled. But ideally, the user should be able to see that field B may be required if they fill A. Ideally, for my current project the second field would be grayed out, i.e., semi-visible, until the first field is filled -- and then required -- but the original feature request above would do. The mysteries (and project requirements) of the perfect UI are never ending. ;-)
Comment #3
Liam MorlandThat could be a feature request for Webform: In addition to be able to hide items, the conditionals system could conditionally disable them.
Comment #4
Liam MorlandThe request can be met with Webform conditionals.