4Science / dspace-angular

Angular UI for DSpace and DSpace-CRIS. In the dspace-cris-7 branch you can find the extension to support DSpace-CRIS
BSD 3-Clause "New" or "Revised" License
14 stars 28 forks source link

unable to delete last row of submission form inline group in existing item #74

Open saschaszott opened 7 months ago

saschaszott commented 7 months ago

Bug description

DSC7 comes with several inline groups in submission-forms.xml, e.g.

      <row>
        <field>
          <dc-schema>oairecerif</dc-schema>
          <dc-element>person</dc-element>
          <dc-qualifier>affiliation</dc-qualifier>
          <label>Affiliation(s)</label>
          <input-type>inline-group</input-type>
          <repeatable>true</repeatable>
          <required />
          <hint />
        </field>
      </row>

The group (in this example oairecerif.person.affiliation) consists of multiple (4) form elements. At least one of them is marked as required:

        <field>
          <dc-schema>oairecerif</dc-schema>
          <dc-element>person</dc-element>
          <dc-qualifier>affiliation</dc-qualifier>
          <label>Organisation name</label>
          <input-type>onebox</input-type>
          <repeatable>false</repeatable>
          <required>You must enter at least the organisation of your affiliation.</required>
          <style>col-xs-12 col-md-6 col-lg-3</style>
          <hint />
        </field>

The UI does not allow to delete the "last row" of a group as you can see in the screenshot below (trash icon is disabled):

image

This means (in this example) that you are not able to delete all affiliations of an existing researcher profile: one row in the group remains and as (in this example) oairecerif.person.affiliation is a mandatory field, you cannot delete all form field values in the remaining row.

@abollini , @atarix83 I'm not sure how a robust fix should look like. An easy option could be to fully remove the disabling of the trash button and allow the user to delete all rows in a given group. If you agree with this proposal, I'll create a PR for that.