unclecheese / silverstripe-display-logic

The Display Logic module allows you to add conditions for displaying or hiding certain form fields based on client-side behavior.
BSD 3-Clause "New" or "Revised" License
74 stars 71 forks source link

Dynamically setting the "required" flag #25

Closed moniuch closed 1 year ago

moniuch commented 10 years ago

Could we have a feature to make fields dynamically required, based on state of other fields? I would for example want to enable a TextField depending on whether currently selected dropdown item (its label, not value) contains a phrase. When the text field gets enabled, it also has to be filled in, so it should be made "required".

michalkleiner commented 1 year ago

Hello! Thank you for raising the feature request and apologies it hasn't been responded to earlier.

If you can provide a PR, we will consider it. However, the suggested feature is a bit out of scope for the module, so we can't dedicate time to it ourselves.

GuySartorelli commented 1 year ago

I'd say validation is definitely out of scope for this module... GuySartorelli/silverstripe-composable-validators has a DependentRequiredFieldsValidator validator I created specifically for this purpose for people who need it.

moniuch commented 1 year ago

Closing the ticket :) I'm no longer a SS user and at that time I might have wrongly identified the correct place to file the request. Thank you.