Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Allow display rules on Editable Field Group #1121

Open
kevin-hine-innis opened this issue Oct 27, 2021 · 2 comments
Open

Feature - Allow display rules on Editable Field Group #1121

kevin-hine-innis opened this issue Oct 27, 2021 · 2 comments

Comments

@kevin-hine-innis
Copy link

Allow display rules on Editable Field Group.
I have a field group and all of the fields in that group need to be conditionally hidden.
This is cumbersome to mange for the content editor.
In addition if all fields in the group are hidden, the group still shows, but is empty (which makes for a poor end user experience).

@kevin-hine-innis
Copy link
Author

Conditionally hidden group fields means we have to handle required fields.
To do so, I updated SilverStripe\UserForms\Form\UserFormsRequiredFields to check if the group field is hidden.
This is simple enough to do, except I could find the group fields in the form data available in that class.

So, I had to load all the form fields from the EditableFormField table in the database then loop through them in sort order to find the group field.

To do so, I had to load them by the form ID, and this was the only way I could figure to get the ID:
$formId = str_replace('Form_', '', $this->form->getName());

Did I overlook something, or is this the best option?

@jackkemmish
Copy link

This would be a really helpful feature built in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants