• 
      

    Add new standard support for subforms on pages.

    Review Request #10950 — Created March 12, 2020 and submitted — Latest diff uploaded

    Information

    Review Board
    release-4.0.x
    51021eb...

    Reviewers

    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:

    1. An -is-subform modifier on rb-c-form-fieldset, which turns a
      fieldset into a subform.

    2. Data attributes for specifying a subform group, ID, and a controller
      element ID (which is used to automatically manage subform displays).

    3. Guidance on setting both the disabled and hidden 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).

    4. Support in RB.FormView for automatically setting up and managing
      subform state based on the data attributes.

    5. 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.