Add new standard support for subforms on pages.
Review Request #10950 — Created March 12, 2020 and submitted
We have a number of pages in the administration UI today that make use
of subforms, which are forms dynamically hidden or shown based on
the selection on another form control. Each one of these had to be
written manually, which made implementations inconsistent and sometimes
buggy.This change introduces a new formal subform implementation, which we'll
be able to start using in the settings pages. There are several new
things introduced here:
An
-is-subform
modifier onrb-c-form-fieldset
, which turns a
fieldset into a subform.Data attributes for specifying a subform group, ID, and a controller
element ID (which is used to automatically manage subform displays).Guidance on setting both the
disabled
andhidden
attributes to
ensure the form's data won't be validated or sent to the server, and
hiding the form from display and from screen readers (note that
hidden
is an HTML 5.1 attribute, which is available in all our
supported browsers, including IE11).Support in
RB.FormView
for automatically setting up and managing
subform state based on the data attributes.Standard templates for representing a form instance as a subform,
and a dictionary of subform IDs to forms as subforms.Upcoming changes will update other forms to use this, fixing our form
validation issues on Django 1.11.
Unit tests pass.
Made use of this to update all the existing subforms (which will be
in an upcoming change). Verified everything worked as expected.
Description | From | Last Updated |
---|---|---|
Col: 48 ['group1'] is better written in dot notation. |
reviewbot | |
Col: 48 ['group2'] is better written in dot notation. |
reviewbot | |
Col: 41 ['group1'] is better written in dot notation. |
reviewbot | |
Col: 51 ['subform1'] is better written in dot notation. |
reviewbot | |
Col: 41 ['group1'] is better written in dot notation. |
reviewbot | |
Col: 51 ['subform2'] is better written in dot notation. |
reviewbot | |
Col: 41 ['group2'] is better written in dot notation. |
reviewbot | |
Col: 51 ['subform3'] is better written in dot notation. |
reviewbot | |
Col: 41 ['group2'] is better written in dot notation. |
reviewbot | |
Col: 51 ['subform4'] is better written in dot notation. |
reviewbot | |
Should be "Render the view" |
david | |
Should this really be set to have a default, since options.group is required? Perhaps we should remove the default value … |
david | |
controllerGroup? |
david |
- Change Summary:
-
Fixed Review Bot complaints.
- Commit:
-
5f17f4b90455353cac84c533ce6410c9da9c8163797b0688e3b80b5d3abfb4266ea3d55826e7ded5
Checks run (2 succeeded)
- Change Summary:
-
- Fixed a doc comment.
- Fixed a variable name due to a search/replace.
- Removed the default for
options
insetSubformVisibility()
and added an assertion.
- Commit:
-
797b0688e3b80b5d3abfb4266ea3d55826e7ded551021eb9cc1eb2e49d2bc39ae8dc4fe4ef1fed0c