Can't save extra custom fields when inline and required
Overview
If you have a custom field set that allows multiple records with a required field and uses the inline style, then one record can be created but a second fails with ' ... is a required field' for all required fields.
Reproduction steps
Setup: Create a custom field set:
- Click on Administer -> Customize Data and Screens > Custom Fields.
- Click Add Set of Custom Fields
- Set Name: 'Test fields', Used for: Contacts, Does this Custom Field Set allow multiple records?: ticked, Display Style: Inline
- Click Save
- Field Label: Test, Data Type: Alphanumeric, Field input type: single-line input, Required: ticked [NB seems to affect all types, key thing is this is Required]
- Click Save
Create first record:
- Choose a contact
- In 'Test fields' custom fields section, click Edit, enter a value for 'Test' field, click Save [Should succeed]
Try to create second record - need to use 'Edit Contact'
- On contact view, click Edit
- In 'Test fields' section, click Another Test fields record
- Enter value, click Save
- Get
Please correct the following errors in the form fields below: Test is a required field.
Current behaviour
Second field produces error
Expected behaviour
Second field saves without error
Environment information
- CiviCRM: 5.41.0, Master. This used to work seems to have changed somewhere between 5.36.1 and 5.41.0
Comments
- The field saves correctly if not 'required'.
- The field saves correctly if displayed as 'Tab' or 'Tab with Table'. Problem occurs only when both 'Required' and 'Inline'.