specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
65 stars 36 forks source link

Subforms with [initialize="addsearch=true"] not allowing data entry on Specify 7 #5129

Open totallynotleo opened 2 months ago

totallynotleo commented 2 months ago

Hello, I asked about this on the speciforum a few months ago but didn't get any response: https://discourse.specifysoftware.org/t/appraisal-co-subform-not-allowing-cos-to-be-added/1776

Describe the bug It might be an issue with our configuration of Specify 7, but none of the subforms that contain the initialize="addsearch=true" search feature allow for either searching or adding of fields. I've noticed it on all subforms that have the addsearch, but the most pressing one for us is the collectionobjectsub. The functionality works correctly on our Specify 6 instance, and the xml for collectionobjectsub matches the example xml. Let me know if there's something simple that I'm missing.

To Reproduce Steps to reproduce the behavior:

  1. Go to a form that contains a subform with the addsearch=true field.
  2. Try to click the add a Collection Object from the subform

Expected behavior A search button/space to add a collection object appears. The add/minus buttons are not greyed out.

Screenshots Appraisal Form with greyed out CollectionObjectSub: image XML for Appraisal Form (slightly different to the actual form, but the subview is the same) image Search Functionality in Specify 6 working as expected: image

Reported By Queensland Herbarium Additional context Also noticed on the CollectingTrip collectingeventsubform as well as the Institution contentContacts subform.

grantfitzsimmons commented 2 months ago

Hi @totallynotleo –

Thank you for following up on your initial post!

This issue affects all independent subviews, where adding the base record (CO) to the parent record (Appraisal) requires updating the base record (CO) at a database level. This is because the collectionobject table in the database has a foreign key to the appraisal table.

Dependent subviews are not affected by this as the dependent records are newly created, therefore it does not need to update the other table in the database.

You can see which relationships are "dependent" or "independent" using the Data Model Viewer within Specify (https://sp7demofish.specifycloud.org/specify/data-model/):

image

Adding new records to independent subviews is currently not supported in Specify 7, which is why the plus and minus buttons are greyed out. The only option now is to add the Collection Object to the Appraisal by linking it via the Collection Object form, not the Appraisal form.

We have the following issue open to track this: https://github.com/specify/specify7/issues/2181

Our developers are working on a solution to this issue. The fix is expected to arrive within the next few months. Thank you again for your issue!